最近遇到一个问题,就是在
这样的注册表项,在QT中,可以读取注册表左边的key,但是无法获取右边的value,
发现之前的人也遇到相同的问题:http://www.qtcn.org/bbs/read-htm-tid-55782.html
其实,这个东西Qt的文档中说的很明确:
Note that the backslash character is, as mentioned, used by QSettings to separate subkeys. As a result, you cannot read or write windows registry entries that contain slashes or backslashes; you should use a native windows API if you need to do so.
遇到这种情况,需要在QT中调用windows API进行解决。
(1)在QT中添加windows API操作注册表需要的静态库和头文件
在项目pro文件中添加:
LIBS += -lAdvapi32
添加头文件
#include <qt_windows.h>
(2)
参考资料:
使用RegOpenKeyEx 等windows注册函数时,编译无法解析问题 https://blog.csdn.net/linuxsmallping/article/details/51722648