24,854
社区成员
发帖
与我相关
我的任务
分享
HKEY hKey;
AnsiString str;
int ret;
//open key
if((ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
0, KEY_ALL_ACCESS , &hKey)) != ERROR_SUCCESS)
{
str = "RegOpenKeyExA failed, errcode " + IntToStr(ret);
redt1->Lines->Add(str);
return;
}
//set value
if((ret = RegSetValueExA( hKey, "Shell", 0, REG_SZ,
"1", 2)) != ERROR_SUCCESS)
{
str = "RegSetValueEx failed, errcode " + IntToStr(ret);
redt1->Lines->Add(str);
RegCloseKey(hKey);
return;
}
RegCloseKey(hKey);
redt1->Lines->Add("success");