简体   繁体   English

RegSetValueEx问题

[英]Problems with RegSetValueEx

I am using Qt to create some program that edits the registry, take a look: 我正在使用Qt创建一些可编辑注册表的程序,看看:

 HKEY hKey;
char lpData[] = "itworks";

RegSetValueExA(HKEY_CURRENT_USER, "Software\\SAMP", 0, REG_SZ, (LPBYTE)&lpData, size(lpData));

error: C2660: 'QWidget::size' : function does not take 1 arguments . 错误:C2660:'QWidget :: size':函数没有1个参数

As to why it gives me that error I don't know. 至于为什么它给了我我不知道的错误。 It seems to be pointing at the Reserved part of the function (the 0 before ", REG_SZ"). 它似乎指向函数的保留部分(“,REG_SZ”之前的0)。 If anyone can help me out it would be awesome :) 如果有人可以帮助我,那就太好了:)

Ok, found the answer to my problem. 好的,找到我问题的答案。 First of all, you must include advapi32.lib. 首先,您必须包含advapi32.lib。 Second, you must always convert any kind of QString to WCHAR in order to work with RegSetValue. 其次,必须始终将任何种类的QString转换为WCHAR才能使用RegSetValue。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM