vc中怎么修改注册表值啊??

来源:百度知道 编辑:UC知道 时间:2024/06/16 05:03:06
我会导入注册表可是不会修改!

void CRegDlg::OnBtnCreate()
{
// TODO: Add your control notification handler code here
CString str;
str="C:\\WINDOWS\\SYSTEM32\\NOTEPAD.EXE";
HKEY hkey;
::RegOpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&hkey);
::RegSetValueEx(hkey,"Notepad.exe",NULL,REG_SZ,(const BYTE*)(str.GetBuffer(str.GetLength())),str.GetLength());
::RegCloseKey(hkey);
}

void CRegDlg::OnBtnDelete()
{
// TODO: Add your control notification handler code here
CString str;
HKEY hkey;
::RegOpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&hkey);
::RegSetValueEx(hkey,"Notepad.exe",NULL,REG_SZ,NULL,0);
::RegCloseKey(hkey);
}

void CRegDlg::OnBtnQuery()
{
// TODO: Add your control notificatio