我在编程操作注册时,只能对注册表的键值进行添加、修改、查看等操作,却不能添加注册表的路径,请各位指教!

解决方案 »

  1.   

    RegCreateKeyEx
    The RegCreateKeyEx function creates the specified registry key. If the key already exists, the function opens it.LONG RegCreateKeyEx(
      HKEY hKey,                                  // handle to open key
      LPCTSTR lpSubKey,                           // subkey name
      DWORD Reserved,                             // reserved
      LPTSTR lpClass,                             // class string
      DWORD dwOptions,                            // special options
      REGSAM samDesired,                          // desired security access
      LPSECURITY_ATTRIBUTES lpSecurityAttributes, // inheritance
      PHKEY phkResult,                            // key handle 
      LPDWORD lpdwDisposition                     // disposition value buffer
    );=========================================================The key that the RegCreateKeyEx function creates has no values. An application can use the RegSetValue or RegSetValueEx function to set key values. The key identified by the hKey parameter must have been opened with KEY_CREATE_SUB_KEY access. To open the key, use the RegCreateKeyEx or RegOpenKeyEx function. An application cannot create a key that is a direct child of HKEY_USERS or HKEY_LOCAL_MACHINE. An application can create subkeys in lower levels of the HKEY_USERS or HKEY_LOCAL_MACHINE trees.An application can use RegCreateKeyEx to temporarily lock a portion of the registry. When the locking process creates a new key, it receives the disposition value REG_CREATED_NEW_KEY, indicating that it "owns" the lock. Another process attempting to create the same key receives the disposition value REG_OPENED_EXISTING_KEY, indicating that another process already owns the lock. Windows 95/98: No registry subkey or value name may exceed 255 characters. 
      

  2.   

    好象RegCreateKeyEx只能创建键值,如何创建注册表的路径值?
      

  3.   

    agree with godsmile
    RegCreateKeyEx
      

  4.   

    直接用RegCreateKey()也可以啊,
    只要第二个参数写成“..\\..\\..”就行了
      

  5.   

    我想在HKEY_CURRENT_USER下的software目录下建一个ABC的目录如何建立?
      

  6.   

    DWORD dwDisp =0;
    HKEY hKeyConnections;
    RegCreateKeyEx(HKEY_CURRENT_USER,_T("Software\\ABC"), 0, NULL, 
       REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKeyConnections, &dwDisp);
      

  7.   

    在2000中不要使用\\software\\abc而应该Software\\abc
    但是98好像是可以的
      

  8.   

    HKEY handle,subhandle;RegCreateKey(HKEY_CURRENT_USER,"Software",&handle);
    RegCreateKey(handle,"ABC",&subhandle);
    这样也可以实现,我做过测试
      

  9.   

    HKEY hKey;
    ::RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\ABC",0,0,0,KEY_ALL_ACCESS,0,
    &hKey,0)
      

  10.   

    MFC提供了一个CRegKey类,可以对注册表进行简单的操作。我用过,使用很简单,看一下MSDN,就会了。