想删除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;

解决方案 »

  1.   

    有个注册表封装类,你搜下,VS2008SP1也有CRegKey这个封装类。
    lRet=RegDeleteValue(hRootKey,_T("ServiceDll"); 
    if(lRet==ERROR_SUCCESS) 
    {
    MessageBox( NULL,"open the key run success ",NULL,NULL);
    }
    else
    {
    MessageBox(NULL,"false",NULL,NULL);
    }
      

  2.   

    我有个写好的DLL,专门封装了注册表操作,你贴下邮箱发你
      

  3.   

    lstrcpy(path, "SYSTEM\\CurrentControlSet\\Services\\NWCWorkstation\\Parameters");  
      

  4.   

    3楼能提供源码吗?我邮箱396622525#qq.com
    #换成@
      

  5.   

    //删除key的值
    RegDeleteValue()
    //删除key
    RegDleteKey()
      

  6.   

    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);
    } 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 ';'晕了~~请大家帮下
      

  7.   

    //lRet=RegDeleteValue(hRootKey,_T("ServiceDll")); //少了个")"吧
      

  8.   

    嗯~忘记了。谢谢。。error C2065: '_T' : undeclared identifier。。这个怎么解决、、未定义、、
      

  9.   

    // 你的IDE居然不支持_T()宏?
    // 真的不支持的话,去掉好了。
    lRet=RegDeleteValue(hRootKey, "ServiceDll"); 
      

  10.   

    也发我一份,谢谢![email protected]
      

  11.   


    //兼容MBCS和unicode工程用的。
    // 如果是unicode _T("") = L"";
    // MBCS _T("") = "";