home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / samples / c08 / querydef / querydef.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  3.5 KB  |  138 lines

  1. // QueryDef.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "QueryDef.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "QDefSet.h"
  9. #include "QDefDoc.h"
  10. #include "QDefView.h"
  11.  
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CQueryDefApp
  20.  
  21. BEGIN_MESSAGE_MAP(CQueryDefApp, CWinApp)
  22.     //{{AFX_MSG_MAP(CQueryDefApp)
  23.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG_MAP
  27. END_MESSAGE_MAP()
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CQueryDefApp construction
  31.  
  32. CQueryDefApp::CQueryDefApp()
  33. {
  34.     // TODO: add construction code here,
  35.     // Place all significant initialization in InitInstance
  36. }
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // The one and only CQueryDefApp object
  40.  
  41. CQueryDefApp theApp;
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CQueryDefApp initialization
  45.  
  46. BOOL CQueryDefApp::InitInstance()
  47. {
  48.     // Standard initialization
  49.     // If you are not using these features and wish to reduce the size
  50.     //  of your final executable, you should remove from the following
  51.     //  the specific initialization routines you do not need.
  52.  
  53. #ifdef _AFXDLL
  54.     Enable3dControls();            // Call this when using MFC in a shared DLL
  55. #else
  56.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  57. #endif
  58.  
  59.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  60.  
  61.     // Register the application's document templates.  Document templates
  62.     //  serve as the connection between documents, frame windows and views.
  63.  
  64.     CSingleDocTemplate* pDocTemplate;
  65.     pDocTemplate = new CSingleDocTemplate(
  66.         IDR_MAINFRAME,
  67.         RUNTIME_CLASS(CQueryDefDoc),
  68.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  69.         RUNTIME_CLASS(CQueryDefView));
  70.     AddDocTemplate(pDocTemplate);
  71.  
  72.     // Parse command line for standard shell commands, DDE, file open
  73.     CCommandLineInfo cmdInfo;
  74.     ParseCommandLine(cmdInfo);
  75.  
  76.     // Dispatch commands specified on the command line
  77.     if (!ProcessShellCommand(cmdInfo))
  78.         return FALSE;
  79.  
  80.     return TRUE;
  81. }
  82.  
  83. /////////////////////////////////////////////////////////////////////////////
  84. // CAboutDlg dialog used for App About
  85.  
  86. class CAboutDlg : public CDialog
  87. {
  88. public:
  89.     CAboutDlg();
  90.  
  91. // Dialog Data
  92.     //{{AFX_DATA(CAboutDlg)
  93.     enum { IDD = IDD_ABOUTBOX };
  94.     //}}AFX_DATA
  95.  
  96.     // ClassWizard generated virtual function overrides
  97.     //{{AFX_VIRTUAL(CAboutDlg)
  98.     protected:
  99.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  100.     //}}AFX_VIRTUAL
  101.  
  102. // Implementation
  103. protected:
  104.     //{{AFX_MSG(CAboutDlg)
  105.         // No message handlers
  106.     //}}AFX_MSG
  107.     DECLARE_MESSAGE_MAP()
  108. };
  109.  
  110. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  111. {
  112.     //{{AFX_DATA_INIT(CAboutDlg)
  113.     //}}AFX_DATA_INIT
  114. }
  115.  
  116. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  117. {
  118.     CDialog::DoDataExchange(pDX);
  119.     //{{AFX_DATA_MAP(CAboutDlg)
  120.     //}}AFX_DATA_MAP
  121. }
  122.  
  123. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  124.     //{{AFX_MSG_MAP(CAboutDlg)
  125.         // No message handlers
  126.     //}}AFX_MSG_MAP
  127. END_MESSAGE_MAP()
  128.  
  129. // App command to run the dialog
  130. void CQueryDefApp::OnAppAbout()
  131. {
  132.     CAboutDlg aboutDlg;
  133.     aboutDlg.DoModal();
  134. }
  135.  
  136. /////////////////////////////////////////////////////////////////////////////
  137. // CQueryDefApp commands
  138.