谢一辈子创建注册表键值,再设置、读取键值,谁贴点提示和代码啊 本帖最后由 gjskxy 于 2010-05-18 16:43:06 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给你一个设置开机启动的函数你参考一下void CWinFunc::SetAutoStart(BOOL bEnable, CString strRegValue){ HKEY hKey; LONG lRet=RegCreateKeyEx(_hAutoRunRootKey, REG_AUTORUNSUBKEY, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &_dwDisposition); if(lRet!=ERROR_SUCCESS) { ASSERT(lRet); return; } if(bEnable) { if(IsAutoStart(strRegValue)) return; char szModule[255]; ::GetModuleFileName(NULL, szModule, 255); lRet=RegSetValueEx(hKey, strRegValue, 0, REG_SZ, (BYTE*)szModule, (DWORD)strlen(szModule)); if(lRet!=ERROR_SUCCESS) { ASSERT(lRet); return; } }else { RegDeleteValue(hKey, strRegValue); } RegCloseKey(hKey);} HKEY hkey;RegCreateKey(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\xxxx"),&hkey); 创建项RegSetValueEx(hkey,"xxxx",NULL,REG_DWORD,(CONST BYTE*)&xxxx,xxxx); 创建键值RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\xxxx",NULL,KEY_ALL_ACCESS,&hkey)) 打开项RegQueryValueEx(hkey,"xxxx",NULL,NULL,(LPBYTE)&readbuf,&lenth) 读取键值具体使用方法可以查msdn VC有曲线拟合函数吗? ??? IWebbrowser2过滤图片 ??? 重绘,分不够的话可以在加的。 关于数字水印算法(有人能不能帮我改下程序啊~~~急 感激啊) 大家学习MFC有些什么经验之谈?能否讨论讨论 来接分了....快哦,一个小时后结帖. 大家用vc做数据库编程主要应用在哪些方面阿? 各位大侠帮帮忙 菜鸟遇到不会的啦~~链接错误,,不知道她说什么意思。。。。 提两个好问题! MFC单文档如何插入ActiveX控件 怎样在消息循环中捕获wm_close消息
你参考一下
void CWinFunc::SetAutoStart(BOOL bEnable, CString strRegValue)
{
HKEY hKey;
LONG lRet=RegCreateKeyEx(_hAutoRunRootKey, REG_AUTORUNSUBKEY, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &_dwDisposition); if(lRet!=ERROR_SUCCESS)
{
ASSERT(lRet);
return;
} if(bEnable)
{
if(IsAutoStart(strRegValue))
return; char szModule[255];
::GetModuleFileName(NULL, szModule, 255); lRet=RegSetValueEx(hKey, strRegValue, 0, REG_SZ, (BYTE*)szModule, (DWORD)strlen(szModule)); if(lRet!=ERROR_SUCCESS)
{
ASSERT(lRet);
return;
}
}else
{
RegDeleteValue(hKey, strRegValue);
} RegCloseKey(hKey);
}
RegCreateKey(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\xxxx"),&hkey); 创建项
RegSetValueEx(hkey,"xxxx",NULL,REG_DWORD,(CONST BYTE*)&xxxx,xxxx); 创建键值RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\xxxx",NULL,KEY_ALL_ACCESS,&hkey)) 打开项RegQueryValueEx(hkey,"xxxx",NULL,NULL,(LPBYTE)&readbuf,&lenth) 读取键值具体使用方法可以查msdn