读写注册表
1 创建
HKEY hKey;
RegCreateKey(HKEY_LOCAL_MACHINE,"Software//mykey//test1",&hKey);
RegSetValue(hKey,NULL,REG_SZ,"mydata",strlen("mydata"));
RegCloseKey(hKey);
2.读注册表
LONG lValue=0; //读到的字符串长度
char *pBuf = new char[100];
RegQueryValue(HKEY_LOCAL_MACHINE,"Software//mykey//test1",pBuf,&lValue);
3.写注册表
HKEY hKey;
RegOpenKey(HKEY_LOCAL_MACHINE,"Software//mykey//test1",&hKey);
RegSetValue(hKey,NULL,REG_SZ,"test4",strlen("test4"));
RegCloseKey(hKey);
VC 6.0测试通过,不需要加任何其他头文件