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.
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.
RegCreateKeyEx
只要第二个参数写成“..\\..\\..”就行了
HKEY hKeyConnections;
RegCreateKeyEx(HKEY_CURRENT_USER,_T("Software\\ABC"), 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKeyConnections, &dwDisp);
但是98好像是可以的
RegCreateKey(handle,"ABC",&subhandle);
这样也可以实现,我做过测试
::RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\ABC",0,0,0,KEY_ALL_ACCESS,0,
&hKey,0)