重大注册表问题!!! 直接RegSetValueEx(hKey,lpValueName,0,REG_SZ,(BYTE*)string.GetBuffer(string.GetLenght()),string.GetLenght())不行吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 RegSetValueEx(hKey,lpValueName,0,REG_SZ,(BYTE*)string.GetBuffer(string.GetLenght()),string.GetLenght()+1) 给你一个函数:void CTEMPDlg::CreateSetRegKeyValue(CString strKeyValue,char * pKeyValue){ DWORD dwErrorCode; char * pData; HKEY hKey; DWORD dwDisposition; dwErrorCode=::RegCreateKeyEx(HKEY_CURRENT_USER, strKeyValue.GetBuffer(strKeyValue.GetLength()), 0,"",REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS, NULL,&hKey,&dwDisposition); if (dwErrorCode != ERROR_SUCCESS){ AfxMessageBox("Create Key Faile!"); } pData=pKeyValue; dwErrorCode=::RegSetValueEx(HKEY_CURRENT_USER, strKeyValue.GetBuffer(strKeyValue.GetLength()), 0,REG_SZ,(LPBYTE)pData,strlen(pData)); if (dwErrorCode != ERROR_SUCCESS){ AfxMessageBox("Set KeyValue Faile!"); } RegCloseKey(hKey);} 哇!怎么提交上去会这样?!!再来一次void CreateSetRegKeyValue1(CString strKeyValue,char * pKeyValue){ DWORD dwErrorCode; char * pData; HKEY hKey; DWORD dwDisposition; dwErrorCode=::RegCreateKeyEx(HKEY_CURRENT_USER, strKeyValue.GetBuffer(strKeyValue.GetLength()), 0,"",REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS, NULL,&hKey,&dwDisposition); if (dwErrorCode != ERROR_SUCCESS){ AfxMessageBox("Create Key Faile!"); } pData=pKeyValue; dwErrorCode=::RegSetValueEx(HKEY_CURRENT_USER, strKeyValue.GetBuffer(strKeyValue.GetLength()), 0,REG_SZ,(LPBYTE)pData,strlen(pData)); if (dwErrorCode != ERROR_SUCCESS){ AfxMessageBox("Set KeyValue Faile!"); } RegCloseKey(hKey);} 还是老样子,就这样吧,你拷回去,选中,然后按ALT+F8,就会自动对齐了 CString转换int 变成一个很大的负数???? 如何获取本机的显示器硬件信息,如型号、尺寸等等。 VC6.0安装不成功,又删不了,怎么办 [求助]各位请帮忙,关于怎么用Voip在两台电脑间通话! ~新手的问题~~~~~~~~~在线等! 关于按钮消息传递的问题(郁闷中。。) 100分求字典的算法 用MAPI怎样取出邮件附件,急用 有人知道MSDN在什么地方升级吗? 为什么得不到段地址? 怪怪问题??? 为什么没他妈的人回答,也不难呀!!!!!!!!!!!!!!
void CTEMPDlg::CreateSetRegKeyValue(CString strKeyValue,char * pKeyValue)
{
DWORD dwErrorCode;
char * pData;
HKEY hKey;
DWORD dwDisposition;
dwErrorCode=::RegCreateKeyEx(HKEY_CURRENT_USER,
strKeyValue.GetBuffer(strKeyValue.GetLength()),
0,"",REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,
NULL,&hKey,&dwDisposition);
if (dwErrorCode != ERROR_SUCCESS){
AfxMessageBox("Create Key Faile!");
}
pData=pKeyValue;
dwErrorCode=::RegSetValueEx(HKEY_CURRENT_USER,
strKeyValue.GetBuffer(strKeyValue.GetLength()),
0,REG_SZ,(LPBYTE)pData,strlen(pData));
if (dwErrorCode != ERROR_SUCCESS){
AfxMessageBox("Set KeyValue Faile!");
}
RegCloseKey(hKey);
}
{
DWORD dwErrorCode;
char * pData;
HKEY hKey;
DWORD dwDisposition;
dwErrorCode=::RegCreateKeyEx(HKEY_CURRENT_USER,
strKeyValue.GetBuffer(strKeyValue.GetLength()),
0,"",REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,
NULL,&hKey,&dwDisposition);
if (dwErrorCode != ERROR_SUCCESS){
AfxMessageBox("Create Key Faile!");
}
pData=pKeyValue;
dwErrorCode=::RegSetValueEx(HKEY_CURRENT_USER,
strKeyValue.GetBuffer(strKeyValue.GetLength()),
0,REG_SZ,(LPBYTE)pData,strlen(pData));
if (dwErrorCode != ERROR_SUCCESS){
AfxMessageBox("Set KeyValue Faile!");
}
RegCloseKey(hKey);
}