home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / atl / connect / mdrive / mdrive.cpp < prev    next >
C/C++ Source or Header  |  1998-03-26  |  3KB  |  108 lines

  1. // MDrive.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Active Template Library.
  4. // Copyright (C) 1996-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Active Template Library Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Active Template Library product.
  12.  
  13. #include "premdriv.h"
  14. #include "MDrive.h"
  15. #include "DriveDlg.h"
  16.  
  17. #ifdef _DEBUG
  18. #define new DEBUG_NEW
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23. #define IID_DEFINED
  24. #include "..\connect_i.c"
  25.  
  26. CComModule _Module;
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CMDriveApp
  29.  
  30. BEGIN_MESSAGE_MAP(CMDriveApp, CWinApp)
  31.     //{{AFX_MSG_MAP(CMDriveApp)
  32.         // NOTE - the ClassWizard will add and remove mapping macros here.
  33.         //    DO NOT EDIT what you see in these blocks of generated code!
  34.     //}}AFX_MSG
  35.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  36. END_MESSAGE_MAP()
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CMDriveApp construction
  40.  
  41. CMDriveApp::CMDriveApp()
  42. {
  43.     // TODO: add construction code here,
  44.     // Place all significant initialization in InitInstance
  45. }
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // The one and only CMDriveApp object
  49.  
  50. CMDriveApp theApp;
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CMDriveApp initialization
  54.  
  55. BOOL CMDriveApp::InitInstance()
  56. {
  57.     _Module.Init(NULL, NULL);
  58.     // Initialize OLE libraries
  59.     if (!AfxOleInit())
  60.     {
  61.         AfxMessageBox(IDP_OLE_INIT_FAILED);
  62.         return FALSE;
  63.     }
  64.  
  65.     // Standard initialization
  66.     // If you are not using these features and wish to reduce the size
  67.     //  of your final executable, you should remove from the following
  68.     //  the specific initialization routines you do not need.
  69.  
  70. #ifdef _AFXDLL
  71.     Enable3dControls();         // Call this when using MFC in a shared DLL
  72. #else
  73.     Enable3dControlsStatic();   // Call this when linking to MFC statically
  74. #endif
  75.  
  76.     // Parse the command line to see if launched as OLE server
  77.     if (RunEmbedded() || RunAutomated())
  78.     {
  79.         // Register all OLE server (factories) as running.  This enables the
  80.         //  OLE libraries to create objects from other applications.
  81.         COleTemplateServer::RegisterAll();
  82.  
  83.         // Application was run with /Embedding or /Automation.  Don't show the
  84.         //  main window in this case.
  85.         return TRUE;
  86.     }
  87.  
  88.     // When a server application is launched stand-alone, it is a good idea
  89.     //  to update the system registry in case it has been damaged.
  90.     COleObjectFactory::UpdateRegistryAll();
  91.  
  92.     CMDriveDlg dlg;
  93.     m_pMainWnd = &dlg;
  94.     int nResponse = dlg.DoModal();
  95.     if (nResponse == IDOK)
  96.     {
  97. //      dlg.OnStopAll();
  98.     }
  99.     else if (nResponse == IDCANCEL)
  100.     {
  101. //      dlg.OnStopAll();
  102.     }
  103.  
  104.     // Since the dialog has been closed, return FALSE so that we exit the
  105.     //  application, rather than start the application's message pump.
  106.     return FALSE;
  107. }
  108.