CRegKey Members
Methods
Call this method to attach an HKEY to the CRegKey object by setting the m_hKey member handle to hKey. | |
Call this method to release the m_hKey member handle and set it to NULL. | |
Call this method to create the specified key, if it does not exist as a subkey of hKeyParent. | |
The constructor. | |
The destructor. | |
Call this method to remove the specified key from the registry. | |
Call this method to remove a value field from m_hKey. | |
Call this method to detach the m_hKey member handle from the CRegKey object and set m_hKey to NULL. | |
Call this method to enumerate the subkeys of the open registry key. | |
Call this method to write all of the attributes of the open registry key into the registry. | |
Call this method to retrieve a copy of the security descriptor protecting the open registry key. | |
This method notifies the caller about changes to the attributes or contents of the open registry key. | |
Call this method to open the specified key and set m_hKey to the handle of this key. | |
Call this method to retrieve the binary data for a specified value name. | |
Call this method to retrieve the DWORD data for a specified value name. | |
Call this method to retrieve the GUID data for a specified value name. | |
Call this method to retrieve the multistring data for a specified value name. | |
Call this method to retrieve the QWORD data for a specified value name. | |
Call this method to retrieve the string data for a specified value name. | |
Call this method to retrieve the data for the specified value field of m_hKey. Earlier versions of this method are no longer supported and are marked as ATL_DEPRECATED. | |
Call this method to remove the specified key from the registry and explicitly remove any subkeys. | |
Call this method to set the binary value of the registry key. | |
Call this method to set the DWORD value of the registry key. | |
Call this method to set the GUID value of the registry key. | |
Call this method to set the security of the registry key. | |
Call this method to store data in a specified value field of a specified key. | |
Call this method to set the multistring value of the registry key. | |
Call this method to set the QWORD value of the registry key. | |
Call this method to set the string value of the registry key. | |
Call this method to store data in the specified value field of m_hKey. Earlier versions of this method are no longer supported and are marked as ATL_DEPRECATED. |
Converts a CRegKey object to an HKEY. | |
Assignment operator. |
Contains a handle of the registry key associated with the CRegKey object. |
TCHAR szExePath[MAX_PATH] = {0};
if (regKey.Open(HKEY_LOCAL_MACHINE, _T("xxx"), KEY_READ) == ERROR_SUCCESS)
{
TCHAR szPath[1024] = {0};
ULONG ulBytes = 1024;
if (ERROR_SUCCESS == regKey.QueryStringValue(_T("Path"), szPath, &ulBytes))
{
PathRemoveFileSpec(szPath);
PathCombine(szExePath, szPath, _T(".\\xxx.exe"));
}
}
if (regKey.Open(HKEY_CURRENT_USER, szKey, KEY_WRITE) == ERROR_SUCCESS)
{
TCHAR szStrKey[] = _T("xxx");
regKey.SetStringValue(szStrKey, NULL);
}
if (regKey.Create(HKEY_LOCAL_MACHINE, szKey) == ERROR_SUCCESS)
{
TCHAR szKey[] = _T("cc");//
regKey.SetStringValue(szKey, _T("ffffff"));
}