Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
CWinApp::InitInstance
CWinApp                                     Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  virtual    BOOL InitInstance();
 
  Remarks
 
  Windows allows several copies of the same program to be running at the
  same time. Thus, application initialization is conceptually divided into
  two sections: one-time application initialization that is done the first
  time the program runs and instance initialization that runs each time a
  copy of the program runs, including the first time. This function is
  called by the Foundation library implementation of WinMain. Override
  InitInstance to provide initialization for each new instance of your
  application running under Windows. Typically, you override InitInstance
  to construct your main window object and set m_pMainWnd to point to that
  window, as shown here.
 
  BOOL CDerivedApp::InitInstance()
  {
      m_pMainWnd = new CDerivedWindow();
      m_pMainWnd->ShowWindow( m_nCmdShow );
      m_pMainWnd->UpdateWindow();
 
      return TRUE;
  }
 
  Return Value
 
  TRUE if initialization is successful; otherwise FALSE.
 
  See Also
 
  CWinApp::InitApplication
 
 
                                     -♦-