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

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