Application Information and Management

When you write an application, you create a single CWinApp-derived object. At times, you may want to get information about this object from outside the CWinApp-derived object.

The Microsoft Foundation Class Library provides the following global functions to help you accomplish these tasks:

Application Information and Management Functions

AfxBeginThread

Creates a new thread.

AfxEndThread

Terminates the current thread.

AfxFreeLibrary

Decrements the reference count of the loaded dynamic-link library (DLL) module; when the reference count reaches zero, the module is unmapped.

AfxGetApp

Returns a pointer to the application's single CWinApp object.

AfxGetAppName

Returns a string that contains the application's name.

AfxGetInstanceHandle

Returns an HINSTANCE representing this instance of the application.

AfxGetMainWnd

Returns a pointer to the current "main" window of a non-OLE application, or the in-place frame window of a server application.

AfxGetPerUserRegistration

Use this function to determine whether the application redirects registry access to the HKEY_CURRENT_USER (HKCU) node.

AfxGetResourceHandle

Returns an HINSTANCE to the source of the application's default resources. Use this to access the application's resources directly.

AfxGetThread

Retrieves a pointer to the current CWinThread object.

AfxInitRichEdit

Initializes the version 1.0 rich edit control for the application.

AfxInitRichEdit2

Initializes the version 2.0 and later rich edit control for the application.

AfxLoadLibrary

Maps a DLL module and returns a handle that can be used to obtain the address of a DLL function.

AfxRegisterClass

Registers a window class in a DLL that uses MFC.

AfxRegisterWndClass

Registers a Windows window class to supplement those registered automatically by MFC.

AfxSetPerUserRegistration

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

AfxSetResourceHandle

Sets the HINSTANCE handle where the default resources of the application are loaded.

AfxSocketInit

Called in a CWinApp::InitInstance override to initialize Windows Sockets.

AfxWinInit

Called by the MFC-supplied WinMain function, as part of the CWinApp initialization of a GUI-based application, to initialize MFC. Must be called directly for console applications that use MFC.

See Also

Reference

CWinApp Class

Concepts

MFC Macros and Globals