Windows SDK Registry: How can I write data to the registry?
2011-03-30 23:32
441 查看
Q: How can I write data to the registry?
A:
Code:
原文出处:http://www.codeguru.com/forum/showthread.php?s=&threadid=247022
A:
Code:
HKEY hKey; if(::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "System//CurrentControlSet//Control//Windows", 0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS) { DWORD dwValue = 245; // Set value if(::RegSetValueEx(hKey, "NameOfValue", 0, REG_DWORD, reinterpret_cast<BYTE *>(&dwValue), sizeof(dwValue)) != ERROR_SUCCESS) { // Close key ::RegCloseKey(hKey); // Error handling; } // Close key ::RegCloseKey(hKey); } else // Error handling;
原文出处:http://www.codeguru.com/forum/showthread.php?s=&threadid=247022
相关文章推荐
- Windows SDK Registry: How can I read in data from the registry?
- Windows SDK Registry: How can I access the registry?
- How can I force Python's file.write() to use the same newline format in Windows as in Linux (“\r\n”
- Error 1406. Setup cannot write the value DisableExceptionChainValidation to the registry key \SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File
- Error 1406. Setup cannot write the value DisableExceptionChainValidation to the registry key \SOFTWARE\Microsoft\Windows NT\Curr
- discuz 上传头像时 提示 目录不可写 Can not write to the data/tmp folder!
- can not write to the data/tmp folder
- how to solve the problem when you have chmod the directory to 777 but the apache still can not write file
- How Can I Minimize a VI to an Icon on the Windows System Tray?
- [zz]How can I generate PFX file to sign the documents?
- How to use Cipher.exe to overwrite deleted data in Windows Server 2003
- How to generate the complex data regularly to Ministry of Transport of P.R.C by DB Query Analyzer
- Fix win10+vs2013: "Could not find WindowsSDKDir variable from the registry"
- How to get the rowid when insert the data to Oracle database
- How to Change the Default Author in Windows Eclipse?
- Very good way of formatting data. To implement the interface System.Windows.Data.IValueConverter
- Can't create/write to file 'C:\WINDOWS\TEMP\...MYSQL报错解决方法
- mysql启动时提示 can't create/write to file 'D:\mysql\data\prn.pid'
- Dubbo Failed to save registry store file, cause: Can not lock the registry cache file
- FAQ How do I write to the console from a plug-in?