想删除HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NWCWorkstation\Parameters下的ServiceDll里面的这个值
char path[200];
lstrcpy(path, "SYSTEM\\CurrentControlSet\\Services\\NWCWorkstation\\Parameters\\ ");
HKEY hRootKey;
LONG lRet=RegOpenKeyEx(HKEY_LOCAL_MACHINE,path,0,KEY_ALL_ACCESS,&hRootKey);
if(lRet==ERROR_SUCCESS)
{
MessageBox( NULL,"open the key run success ",NULL,NULL);
}
else
{
MessageBox(NULL,"false",NULL,NULL);
}
return 0;
char path[200];
lstrcpy(path, "SYSTEM\\CurrentControlSet\\Services\\NWCWorkstation\\Parameters\\ ");
HKEY hRootKey;
LONG lRet=RegOpenKeyEx(HKEY_LOCAL_MACHINE,path,0,KEY_ALL_ACCESS,&hRootKey);
if(lRet==ERROR_SUCCESS)
{
MessageBox( NULL,"open the key run success ",NULL,NULL);
}
else
{
MessageBox(NULL,"false",NULL,NULL);
}
return 0;
lRet=RegDeleteValue(hRootKey,_T("ServiceDll");
if(lRet==ERROR_SUCCESS)
{
MessageBox( NULL,"open the key run success ",NULL,NULL);
}
else
{
MessageBox(NULL,"false",NULL,NULL);
}
#换成@
RegDeleteValue()
//删除key
RegDleteKey()
lstrcpy(path, "SYSTEM\\CurrentControlSet\\Services\\NWCWorkstation\\Parameters");
HKEY hRootKey;
LONG lRet=RegOpenKeyEx(HKEY_LOCAL_MACHINE,path,0,KEY_ALL_ACCESS,&hRootKey);
if(lRet==ERROR_SUCCESS)
{
MessageBox( NULL,"open the key run success ",NULL,NULL);
}
else
{
MessageBox(NULL,"false",NULL,NULL);
} lRet=RegDeleteValue(hRootKey,_T("ServiceDll");
if(lRet==ERROR_SUCCESS)
{
MessageBox( NULL,"open the key run success ",NULL,NULL);
}
else
{
MessageBox(NULL,"false",NULL,NULL);
} return 0;
Compiling...
注册表编程.cpp
E:\sdk\注册表编程1\注册表编程.cpp(39) : error C2065: '_T' : undeclared identifier
E:\sdk\注册表编程1\注册表编程.cpp(39) : error C2143: syntax error : missing ')' before ';'晕了~~请大家帮下
// 真的不支持的话,去掉好了。
lRet=RegDeleteValue(hRootKey, "ServiceDll");
//兼容MBCS和unicode工程用的。
// 如果是unicode _T("") = L"";
// MBCS _T("") = "";