What happens when a Win32 Application begins:

  1. WinMain makes use of a CWinApp object (or one which inherits from CWinApp)

  2. The CWinApp (or subclass) constructor invokes InitInstance

  3. InitInstance creates (using the already-there m_pMainWnd) an instance of CFrameWnd

  4. CFrameWnd (or subclass) constructor is invoked & created the GUI frame

  5. InitInstance paints & refreshes the GUI window 

  6. Message listener loop begins until GUI closed