函数说明:
LONG RegCreateKey(
HKEY hKey, // handle to an open key
LPCTSTR lpSubKey, // address of name of subkey to open
PHKEY phkResult // address of buffer for opened handle
);
例子:
//to create subkey "HKEY_LOCAL_MACHINESOFTWAREtest"
ret = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWAREtest",&hKey)
根据ret判断成功与否。
函数说明:
LONG RegCreateKeyEx(
HKEY hKey, // handle to an open key
LPCTSTR lpSubKey, // address of subkey name
DWORD Reserved, // reserved
LPTSTR lpClass, // address of class string
DWORD dwOptions, // special options flag
REGSAM samDesired, // desired security access
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
// address of key security structure
PHKEY phkResult, // address of buffer for opened handle
LPDWORD lpdwDisposition // address of disposition value buffer
);
用法都差不多。
记住调用RegSetValueEx 或RegSetValue 设置键值,用RegCloseKeyEx 或RegCloseKey 关闭。