home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / MSVCPUZL.ZIP / PUZZLE.CPP < prev    next >
C/C++ Source or Header  |  1993-11-07  |  3KB  |  127 lines

  1. // puzzle.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "puzzle.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "puzzldoc.h"
  9. #include "puzzlvw.h"
  10.  
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char BASED_CODE THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CPuzzleApp
  18.  
  19. BEGIN_MESSAGE_MAP(CPuzzleApp, CWinApp)
  20.     //{{AFX_MSG_MAP(CPuzzleApp)
  21.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code !
  24.     //}}AFX_MSG_MAP
  25.     // Standard file based document commands
  26.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  27.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  28. END_MESSAGE_MAP()
  29.  
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CPuzzleApp construction
  32.  
  33. CPuzzleApp::CPuzzleApp()
  34. {
  35.     // TODO: add construction code here,
  36.     // Place all significant initialization in InitInstance
  37. }
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // The one and only CPuzzleApp object
  41.  
  42. CPuzzleApp NEAR theApp;
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CPuzzleApp initialization
  46.  
  47. BOOL CPuzzleApp::InitInstance()
  48. {
  49.     // Standard initialization
  50.     // If you are not using these features and wish to reduce the size
  51.     //  of your final executable, you should remove from the following
  52.     //  the specific initialization routines you do not need.
  53.  
  54.     SetDialogBkColor();        // set dialog background color to gray
  55.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  56.  
  57.     // Register the application's document templates.  Document templates
  58.     //  serve as the connection between documents, frame windows and views.
  59.  
  60.     AddDocTemplate(new CSingleDocTemplate(IDR_MAINFRAME,
  61.             RUNTIME_CLASS(CPuzzleDoc),
  62.             RUNTIME_CLASS(CMainFrame),     // main SDI frame window
  63.             RUNTIME_CLASS(CPuzzleView)));
  64.  
  65.  
  66.     // create a new (empty) document
  67.     OnFileNew();
  68.  
  69.     if (m_lpCmdLine[0] != '\0')
  70.     {
  71.         // TODO: add command line processing here
  72.     }
  73.  
  74.     return TRUE;
  75. }
  76.  
  77. /////////////////////////////////////////////////////////////////////////////
  78. // CAboutDlg dialog used for App About
  79.  
  80. class CAboutDlg : public CDialog
  81. {
  82. public:
  83.     CAboutDlg();
  84.  
  85. // Dialog Data
  86.     //{{AFX_DATA(CAboutDlg)
  87.     enum { IDD = IDD_ABOUTBOX };
  88.     //}}AFX_DATA
  89.  
  90. // Implementation
  91. protected:
  92.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  93.     //{{AFX_MSG(CAboutDlg)
  94.         // No message handlers
  95.     //}}AFX_MSG
  96.     DECLARE_MESSAGE_MAP()
  97. };
  98.  
  99. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  100. {
  101.     //{{AFX_DATA_INIT(CAboutDlg)
  102.     //}}AFX_DATA_INIT
  103. }
  104.  
  105. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  106. {
  107.     CDialog::DoDataExchange(pDX);
  108.     //{{AFX_DATA_MAP(CAboutDlg)
  109.     //}}AFX_DATA_MAP
  110. }
  111.  
  112. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  113.     //{{AFX_MSG_MAP(CAboutDlg)
  114.         // No message handlers
  115.     //}}AFX_MSG_MAP
  116. END_MESSAGE_MAP()
  117.  
  118. // App command to run the dialog
  119. void CPuzzleApp::OnAppAbout()
  120. {
  121.     CAboutDlg aboutDlg;
  122.     aboutDlg.DoModal();
  123. }
  124.  
  125. /////////////////////////////////////////////////////////////////////////////
  126. // CPuzzleApp commands
  127.