home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / general / modeless / modeless.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  2.4 KB  |  80 lines

  1. // modeless.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. // This is a part of the Microsoft Foundation Classes C++ library.
  5. // Copyright (C) 1992-1998 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // Microsoft Foundation Classes Reference and related
  10. // electronic documentation provided with the library.
  11. // See these sources for detailed information regarding the
  12. // Microsoft Foundation Classes product.
  13.  
  14. #include "stdafx.h"
  15. #include "modeless.h"
  16. #include "adderdlg.h"
  17. #include "modeldlg.h"
  18.  
  19. #ifdef _DEBUG
  20. #undef THIS_FILE
  21. static char BASED_CODE THIS_FILE[] = __FILE__;
  22. #endif
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CModelessApp
  26.  
  27. BEGIN_MESSAGE_MAP(CModelessApp, CWinApp)
  28.     //{{AFX_MSG_MAP(CModelessApp)
  29.         // NOTE - the ClassWizard will add and remove mapping macros here.
  30.         //    DO NOT EDIT what you see in these blocks of generated code!
  31.     //}}AFX_MSG
  32.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  33. END_MESSAGE_MAP()
  34.  
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CModelessApp construction
  37.  
  38. CModelessApp::CModelessApp()
  39. {
  40.     // TODO: add construction code here,
  41.     // Place all significant initialization in InitInstance
  42. }
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // The one and only CModelessApp object
  46.  
  47. CModelessApp theApp;
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CModelessApp initialization
  51.  
  52. BOOL CModelessApp::InitInstance()
  53. {
  54.     // Standard initialization
  55.     // If you are not using these features and wish to reduce the size
  56.     //  of your final executable, you should remove from the following
  57.     //  the specific initialization routines you do not need.
  58.  
  59.     Enable3dControls();
  60.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  61.  
  62.     CMainDlg dlg;
  63.     m_pMainWnd = &dlg;
  64.     int nResponse = dlg.DoModal();
  65.     if (nResponse == IDOK)
  66.     {
  67.         // TODO: Place code here to handle when the dialog is
  68.         //  dismissed with OK
  69.     }
  70.     else if (nResponse == IDCANCEL)
  71.     {
  72.         // TODO: Place code here to handle when the dialog is
  73.         //  dismissed with Cancel
  74.     }
  75.  
  76.     // Since the dialog has been closed, return FALSE so that we exit the
  77.     //  application, rather than start the application's message pump.
  78.     return FALSE;
  79. }
  80.