home *** CD-ROM | disk | FTP | other *** search
/ Total Destruction / Total_Destruction.iso / addons / zipz / QDS101.ZIP / QDDev / QDTest / QDTest.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-31  |  2.5 KB  |  98 lines

  1. // QDTest.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "QDTest.h"
  6. #include "QDTestDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CQDTestApp
  16.  
  17. BEGIN_MESSAGE_MAP(CQDTestApp, CWinApp)
  18.     //{{AFX_MSG_MAP(CQDTestApp)
  19.         // NOTE - the ClassWizard will add and remove mapping macros here.
  20.         //    DO NOT EDIT what you see in these blocks of generated code!
  21.     //}}AFX_MSG
  22.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  23. END_MESSAGE_MAP()
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CQDTestApp construction
  27.  
  28. CQDTestApp::CQDTestApp()
  29. {
  30.     // TODO: add construction code here,
  31.     // Place all significant initialization in InitInstance
  32. }
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // The one and only CQDTestApp object
  36.  
  37. CQDTestApp theApp;
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CQDTestApp initialization
  41.  
  42. BOOL CQDTestApp::InitInstance()
  43. {
  44.  
  45.     // lets start with initialize our COM libs
  46.     // Well only STA here (only as an example)
  47.     // BTW : don't forget to define _WIN32_DCOM 
  48.     // in stdafx.h
  49.  
  50.     HRESULT hr = ::CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
  51.     if(FAILED(hr))
  52.     {
  53.         AfxMessageBox(_T("Oops no init on COM stuff dude !!!!"));
  54.         return FALSE;
  55.     }
  56.  
  57.     AfxEnableControlContainer();
  58.  
  59.     // Standard initialization
  60.     // If you are not using these features and wish to reduce the size
  61.     //  of your final executable, you should remove from the following
  62.     //  the specific initialization routines you do not need.
  63.  
  64. #ifdef _AFXDLL
  65.     Enable3dControls();            // Call this when using MFC in a shared DLL
  66. #else
  67.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  68. #endif
  69.  
  70.     CQDTestDlg dlg;
  71.     m_pMainWnd = &dlg;
  72.     int nResponse = dlg.DoModal();
  73.     if (nResponse == IDOK)
  74.     {
  75.         // TODO: Place code here to handle when the dialog is
  76.         //  dismissed with OK
  77.     }
  78.     else if (nResponse == IDCANCEL)
  79.     {
  80.         // TODO: Place code here to handle when the dialog is
  81.         //  dismissed with Cancel
  82.     }
  83.  
  84.     // Since the dialog has been closed, return FALSE so that we exit the
  85.     //  application, rather than start the application's message pump.
  86.     return FALSE;
  87. }
  88.  
  89. int CQDTestApp::ExitInstance() 
  90. {
  91.     // Dont forget to release our OLE 
  92.     // libs (actually COM libs but who gives a damn...)
  93.  
  94.     CoUninitialize();
  95.  
  96.     return CWinApp::ExitInstance();
  97. }
  98.