如何查询注册表中是否有某项键值的存在啊?

解决方案 »

  1.   

    RegOpenKey
    出错的就是不存在的
      

  2.   

    LONG RegOpenKey(
      HKEY hKey,        // handle to open key
      LPCTSTR lpSubKey, // name of subkey to open
      PHKEY phkResult   // handle to open key
    );
      

  3.   

    HKEY hKey;
    ::RegOpenKey(HKEY_LOCAL_MACHINE,"SoftWare",&hKey);
    ::RegOpenKey(hKey, "Clock",&hKey);
      

  4.   

    LONG RegOpenKey(
      HKEY hKey,        
      LPCTSTR lpSubKey, 
      PHKEY phkResult   
    );
    呵呵,大家都说了!
      

  5.   

    //取得所需加入的网址字符串CString strKey="Software\\Microsoft\\Internet Explorer\\Main";HKEY hResult;RegOpenKey(HKEY_CURRENT_USER,(LPCTSTR)strKey,&&hResult);//得到欲修改键的句柄SetRegValue(HKEY_CURRENT_USER,strKey,"Start Page",address);RegCloseKey(hResult);//修改注册表相应的值并释放键句柄