操作注册表
来源:互联网 发布:赌博源码 编辑:程序博客网 时间:2024/04/29 07:39
#002 // \"Windows"\\"winsize" = "800*600"#003 //蔡军生 2007/11/05 QQ:9073204 深圳#004 std::wstring GetProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry,#005 LPCTSTR lpszDefault)#006 {#007 //打开应用程序键。#008 HKEY hAppKey = GetAppRegistryKey();#009 if (hAppKey == NULL)#010 {#011 return lpszDefault;#012 } #013 #014 HKEY hSecKey = NULL;#015 DWORD dw;#016 #017 //打开子键。#018 RegCreateKeyEx(hAppKey, lpszSection, 0, REG_NONE,#019 REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,#020 &hSecKey, &dw);#021 RegCloseKey(hAppKey);#022 #023 if (hSecKey == NULL)#024 {#025 return lpszDefault;#026 } #027 #028 //查询键值。#029 std::wstring strValue;#030 DWORD dwType=REG_NONE;#031 DWORD dwCount=0;#032 #033 //先查询键值的长度。#034 LONG lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,#035 NULL, &dwCount);#036 if (lResult == ERROR_SUCCESS)#037 { #038 strValue.resize(dwCount);#039 #040 //查询键值。#041 lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,#042 (LPBYTE)strValue.data(), &dwCount);#043 #044 }#045 #046 RegCloseKey(hSecKey);#047 if (lResult == ERROR_SUCCESS)#048 { #049 return strValue;#050 }#051 #052 return lpszDefault; #053 }
网上转的一份参考
- 操作注册表
- 注册表操作
- 注册表操作
- 操作注册表
- 注册表操作
- 注册表操作
- 注册表操作
- 注册表操作
- 注册表操作
- 注册表操作
- 注册表操作
- 注册表操作
- 操作注册表
- 注册表操作
- 注册表操作
- 注册表操作
- 注册表操作
- 操作注册表
- 我的第二个C++上级报告(摄氏度转华氏度)
- awk:查看Apache的并发请求数及其TCP连接状态数据
- 日期问题
- ireport+struts2集成开发总结二:一些需要注意的小细节
- 在Windows远程桌面的不同会话之间,如何实现程序的互斥?
- 操作注册表
- 好的博客,以后继续添加
- 解读extjs源码之AbstractSelectionModel.js
- 2011年统计用区划代码和城乡划分代码
- 只在博客发发文章罢了
- Latex数学公式中的空格
- 我的第一个C++
- (html4和html5区别)如何在一个input上添加焦点
- OpenRTMFP/Cumulus Primer 入门(3)图解CumulusEdge原理