description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: Registry and TypeLib Global Functions |
Registry and TypeLib Global Functions |
03/27/2019 |
|
|
d58b8a4e-975c-4417-8b34-d3c847f679b3 |
These functions provide support for loading and registering a type library.
Important
The functions listed in the following tables cannot be used in applications that execute in the Windows Runtime.
Name | Description |
---|---|
AfxRegCreateKey | Creates the specified registry key. |
AfxRegDeleteKey | Deletes the specified registry key. |
AfxRegisterPreviewHandler | A helper to register a preview handler. |
AfxUnregisterPreviewHandler | A helper to unregister a preview handler. |
AtlRegisterTypeLib | This function is called to register a type library. |
AtlUnRegisterTypeLib | This function is called to unregister a type library |
AfxRegOpenKey | Opens the specified registry key. |
AfxRegOpenKeyEx | Opens the specified registry key. |
AtlLoadTypeLib | This function is called to load a type library. |
AtlUpdateRegistryFromResourceD | This function is called to update the registry from the supplied resource. |
RegistryDataExchange | This function is called to read from, or write to, the system registry. Called by the Registry Data Exchange Macros. |
These functions control which node in the registry the program uses to store information.
Name | Description |
---|---|
AtlGetPerUserRegistration | Retrieves whether the application redirects registry access to the HKEY_CURRENT_USER ( HKCU) node. |
AtlSetPerUserRegistration | Sets whether the application redirects registry access to the HKEY_CURRENT_USER ( HKCU) node. |
Header: atlbase.h
Use this function to determine whether the application redirects registry access to the HKEY_CURRENT_USER (HKCU) node.
ATLINLINE ATLAPI AtlGetPerUserRegistration(bool* pEnabled);
pEnabled
[out] TRUE indicates that the registry information is directed to the HKCU node; FALSE indicates that the application writes registry information to the default node. The default node is HKEY_CLASSES_ROOT (HKCR).
S_OK if the method is successful, otherwise the HRESULT error code if an error occurs.
Registry redirection is not enabled by default. If you enable this option, registry access is redirected to HKEY_CURRENT_USER\Software\Classes.
The redirection is not global. Only the MFC and ATL frameworks are affected by this registry redirection.
Header: atlbase.h
Creates the specified registry key.
LONG AFXAPI AfxRegCreateKey(HKEY hKey, LPCTSTR lpSubKey, PHKEY phkResult, CAtlTransactionManager* pTM = NULL);
hKey
A handle to an open registry key.
lpSubKey
The name of a key that this function opens or creates.
phkResult
A pointer to a variable that receives a handle to the opened or created key.
pTM
Pointer to a CAtlTransactionManager
object.
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.
Header: afxpriv.h
Deletes the specified registry key.
LONG AFXAPI AfxRegDeleteKey(HKEY hKey, LPCTSTR lpSubKey, CAtlTransactionManager* pTM = NULL);
hKey
A handle to an open registry key.
lpSubKey
The name of the key to be deleted.
pTM
Pointer to a CAtlTransactionManager
object.
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.
Header: afxpriv.h
A helper to register a preview handler.
BOOL AFXAPI AfxRegisterPreviewHandler(LPCTSTR lpszCLSID, LPCTSTR lpszShortTypeName, LPCTSTR lpszFilterExt);
lpszCLSID
Specifies the CLSID of handler.
lpszShortTypeName
Specifies the ProgID of handler.
lpszFilterExt
Specifies the file extension registered with this handler.
Header: afxdisp.h
This function is called to register a type library.
ATLAPI AtlRegisterTypeLib(HINSTANCE hInstTypeLib, LPCOLESTR lpszIndex);
hInstTypeLib
The handle to the module instance.
lpszIndex
String in the format "\\N", where N is the integer index of the type library resource. Can be NULL if no index is required.
Returns S_OK on success, or an error HRESULT on failure.
This helper function is utilized by AtlComModuleUnregisterServer and CAtlComModule::RegisterTypeLib.
Header: atlbase.h
Opens the specified registry key.
LONG AFXAPI AfxRegOpenKey(HKEY hKey, LPCTSTR lpSubKey, PHKEY phkResult, CAtlTransactionManager* pTM = NULL);
hKey
A handle to an open registry key.
lpSubKey
The name of a key that this function opens or creates.
phkResult
A pointer to a variable that receives a handle to the created key.
pTM
Pointer to a CAtlTransactionManager
object.
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.
Header: afxpriv.h
Opens the specified registry key.
LONG AFXAPI AfxRegOpenKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult, CAtlTransactionManager* pTM = NULL);
hKey
A handle to an open registry key.
lpSubKey
The name of a key that this function opens or creates.
ulOptions
This parameter is reserved and must be zero.
samDesired
A mask that specifies the desired access rights to the key.
phkResult
A pointer to a variable that receives a handle to the opened key.
pTM
Pointer to a CAtlTransactionManager
object.
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.
Header: afxpriv.h
A helper to unregister a preview handler.
BOOL AFXAPI AfxUnRegisterPreviewHandler(LPCTSTR lpszCLSID);
lpszCLSID
Specifies the CLSID of the handler to be unregistered.
Header: afxdisp.h
Sets whether the application redirects registry access to the HKEY_CURRENT_USER (HKCU) node.
ATLINLINE ATLAPI AtlSetPerUserRegistration(bool bEnable);
bEnable
[in] TRUE indicates that the registry information is directed to the HKCU node; FALSE indicates that the application writes registry information to the default node. The default node is HKEY_CLASSES_ROOT (HKCR).
S_OK if the method is successful, otherwise the HRESULT error code if an error occurs.
Registry redirection is not enabled by default. If you enable this option, registry access is redirected to HKEY_CURRENT_USER\Software\Classes.
The redirection is not global. Only the MFC and ATL frameworks are affected by this registry redirection.
Header: atlbase.h
This function is called to unregister a type library.
ATLAPI AtlUnRegisterTypeLib(
HINSTANCE hInstTypeLib,
LPCOLESTR lpszIndex);
hInstTypeLib
The handle to the module instance.
lpszIndex
String in the format "\\N", where N is the integer index of the type library resource. Can be NULL if no index is required.
Returns S_OK on success, or an error HRESULT on failure.
This helper function is utilized by CAtlComModule::UnRegisterTypeLib and AtlComModuleUnregisterServer.
Header: atlbase.h
This function is called to load a type library.
ATLINLINE ATLAPI AtlLoadTypeLib(
HINSTANCE hInstTypeLib,
LPCOLESTR lpszIndex,
BSTR* pbstrPath,
ITypeLib** ppTypeLib);
hInstTypeLib
Handle to the module associated with the type library.
lpszIndex
String in the format "\\N", where N is the integer index of the type library resource. Can be NULL if no index is required.
pbstrPath
On successful return, contains the full path of the module associated with the type library.
ppTypeLib
On successful return, contains a pointer to a pointer to the loaded type library.
Returns S_OK on success, or an error HRESULT on failure.
This helper function is utilized by AtlRegisterTypeLib and AtlUnRegisterTypeLib.
This function was deprecated in Visual Studio 2013 and is removed in Visual Studio 2015.
<removed>
This function is called to read from, or write to, the system registry.
HRESULT RegistryDataExchange(
T* pT,
enum RDXOperations rdxOp,
void* pItem = NULL);
pT
A pointer to the current object.
rdxOp
An enum value that indicates which operation the function should perform. See the table in the Remarks section for the allowed values.
pItem
Pointer to the data that is to be read from, or written to, the registry. The data can also represent a key to be deleted from the registry. The default value is NULL.
Returns S_OK on success, or an error HRESULT on failure.
The macros BEGIN_RDX_MAP and END_RDX_MAP expand to a function that calls RegistryDataExchange
.
The possible enum values that indicate the operation the function should perform are shown in the following table:
Enum value | Operation |
---|---|
eReadFromReg | Read data from the registry. |
eWriteToReg | Write data to the registry. |
eDeleteFromReg | Delete the key from the registry. |
Header: atlbase.h