AfxSetPerUserRegistration

Sets whether the application redirects registry access to the HKEY_CURRENT_USER (HKCU) node.

void AFXAPI AfxSetPerUserRegistration(
   BOOL bEnable
);

Parameters

  • [in] bEnable
    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).

Remarks

Before Windows Vista, applications that access the registry usually use the HKEY_CLASSES_ROOT node. However, with Windows Vista, you must run an application in elevated mode to write to HKCR.

This method enables your application to read and write to the registry without running in elevated mode by redirecting registry access from HKCR to HKCU. For more information, see Linker Property Pages.

If you enable registry redirection, the framework redirects access from HKCR to HKEY_CURRENT_USER\Software\Classes. Only the MFC and ATL frameworks are affected by the redirection.

The default implementation accesses the registry under HKCR.

Requirements

Header: afxstat_.h

See Also

Reference

Macros, Global Functions, and Global Variables

AfxGetPerUserRegistration

Other Resources

Application Information and Management