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

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