home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / com / acdual / mfcctrl / autodriv.cpp < prev    next >
C/C++ Source or Header  |  1998-04-02  |  3KB  |  91 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. using namespace ACDual;
  15. #include "autodriv.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.     if (OleInitialize(NULL) != S_OK)
  56.     {
  57.         AfxMessageBox(IDP_OLE_INIT_FAILED);
  58.         return FALSE;
  59.     }
  60.     // Standard initialization
  61.     // If you are not using these features and wish to reduce the size
  62.     //  of your final executable, you should remove from the following
  63.     //  the specific initialization routines you do not need.
  64.  
  65.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  66.  
  67.     CAutoDrivDlg dlg;
  68.     m_pMainWnd = &dlg;
  69.     int nResponse = dlg.DoModal();
  70.     if (nResponse == IDOK)
  71.     {
  72.         // TODO: Place code here to handle when the dialog is
  73.         //  dismissed with OK
  74.     }
  75.     else if (nResponse == IDCANCEL)
  76.     {
  77.         // TODO: Place code here to handle when the dialog is
  78.         //  dismissed with Cancel
  79.     }
  80.  
  81.     // Since the dialog has been closed, return FALSE so that we exit the
  82.     //  application, rather than start the application's message pump.
  83.     return FALSE;
  84. }
  85.  
  86. int CAutoDrivApp::ExitInstance()
  87. {
  88.     OleUninitialize();
  89.     return CWinApp::ExitInstance();
  90. }
  91.