Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
class CWinApp
◄CObject►                                     ◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  Description
 
  Use the CWinApp class to create a Windows application object. An
  application object provides member functions for initializing the
  application (and each instance of it) and for running the application.
 
  Each application that uses the Foundation classes can only contain one
  CWinApp object. This object is constructed when other C++ global objects
  are constructed and is already available when Windows calls the WinMain
  function, which is supplied by the Foundation Class Library. Declare
  your CWinApp object at the global level or statically.
 
  Typically, you will derive an application class from CWinApp and
  override the ◄InitInstance► member function to create your application's
  main window object.
 
  The Microsoft Foundation Class Library provides a number of global
  functions that you can use to access your CWinApp object, as shown by
  the following list. These functions are available from C or C++.
 
  Function                 Purpose
 
  ◄AfxGetApp►              Obtain a pointer to the CWinApp object.
 
  ◄AfxGetInstanceHandle►   Obtain a handle to the current application
                           instance.
 
  ◄AfxGetResourceHandle►   Obtain a handle to the application's
                           resources.
 
  ◄AfxGetAppName►          Obtain a pointer to a string containing the
                           application's name.
 
  NOTE: Most users of the Foundation classes will use the default WinMain
        provided by the Foundation class library. If you provide your own
        version of WinMain, you must call AfxWinInit before using a
        Foundation class to attach your CWinApp object to the Foundation
        Class Library.
 
  Public Members
 
  Data Members
 
  ◄m_pszAppName►      Specifies the name of the application.
 
  ◄m_hInstance►       Corresponds to the <hInstance> parameter passed by
                      Windows to WinMain.
 
  ◄m_hPrevInstance►   Corresponds to the <hPrevInstance> parameter passed
                      by Windows to WinMain.
 
  ◄m_lpCmdLine►       Corresponds to the <lpCmdLine> parameter passed by
                      Windows to WinMain.
 
  ◄m_nCmdShow►        Corresponds to the <nCmdShow> parameter passed by
                      Windows to WinMain.
 
  ◄m_pMainWnd►        Holds a pointer to the application's main window.
                      See ◄InitInstance► for an example of how to
                      initialize m_pMainWnd.
 
  Construction/Destruction
 
  ◄CWinApp►   Constructs a CWinApp object.
 
  Operations
 
  ◄LoadCursor►           Loads a cursor resource, or a resource handle if
                         the resource has been loaded previously.
 
  ◄LoadStandardCursor►   Loads a Windows predefined cursor specified by
                         IDC_ constants from WINDOWS.H.
 
  ◄LoadOEMCursor►        Loads a Windows OEM predefined cursor specified
                         by OCR_ constants from WINDOWS.H.
 
  ◄LoadIcon►             Loads an icon resource, or a resource handle if
                         the resource has been loaded previously.
 
  ◄LoadStandardIcon►     Loads a Windows predefined icon specified by IDI_
                         constants from WINDOWS.H.
 
  ◄LoadOEMIcon►          Loads a Windows OEM predefined icon specified by
                         OIC_ constants from WINDOWS.H.
 
  Overridables
 
  ◄InitApplication►       Performs any application-level initialization
                          when overridden. (Sometimes override.)
 
  ◄InitInstance►          Performs Windows instance initialization, such
                          as creating your window objects when overridden.
                          (Always override.)
 
  ◄Run►                   Runs the default message loop. Override to
                          customize the message loop. (Seldom override.)
 
  ◄OnIdle►                Overrride to perform application-specific
                          idle-time processing. (Sometimes override.)
 
  ◄ExitInstance►          Override to clean up when your application
                          terminates. (Sometimes override.)
 
  ◄PreTranslateMessage►   Filters messages before they are dispatched to
                          the Windows functions TranslateMessage and
                          DispatchMessage. (Seldom override.)
 
  Protected Members
 
  ◄m_msgCur►   Specifies the last window message retrieved by Run; only
               useful if the message is currently being processed.
 
 
                                     -♦-