Partager via


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

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 containing 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.

AfxGetResourceHandle

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

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 get the address of a DLL function.

AfxRegisterWndClass

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

AfxSocketInit

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

AfxSetResourceHandle

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

AfxRegisterClass

Registers a window class in a DLL that uses MFC.

AfxBeginThread

Creates a new thread.

AfxEndThread

Terminates the current thread.

AfxGetThread

Retrieves a pointer to the current CWinThread object.

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 using MFC.

See Also

Concepts

MFC Macros and Globals

CWinApp Class