MFC写入注册表问题

来源:百度知道 编辑:UC知道 时间:2024/06/30 06:36:19
在MFC中写了如下代码
HKEY hKey;
HKEY hSubKey;
DWORD dwValue;
dwValue = 1;
if (RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\daheng_directx", &hKey) == ERROR_SUCCESS) {
// 在这里就可以使用hKey来操作daheng_directx这个KEY里面的值了。
}
RegCloseKey(hKey);
出现cannot convert parameter 2 from 'const char [24]' to 'LPCWSTR'这个错误
请问怎么解决!!!!!!!!!急急急

if (RegCreateKey(HKEY_LOCAL_MACHINE,_T( "Software\\daheng_directx"), &hKey) == ERROR_SUCCESS)
就可以了!祝您好运!

使用多字符进行编译可以解决08与6.0之间的兼容问题
如果不想使用多字符就用_T("string")进行转换!