home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Power Pack / Visual_Basic4_Power_Pack.bin / vb4files / schedvbx / samples.z / VCSAMP1.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-05  |  4.0 KB  |  152 lines

  1. // vcsamp1.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "vcsamp1.h"
  6.  
  7. #include "schedvbx.h"
  8.  
  9. #include "mainfrm.h"
  10. #include "vcsamdoc.h"
  11. #include "vcsamvw.h"
  12.  
  13. #ifdef _DEBUG
  14. #undef THIS_FILE
  15. static char BASED_CODE THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CVcsamp1App
  20.  
  21. BEGIN_MESSAGE_MAP(CVcsamp1App, CWinApp)
  22.     //{{AFX_MSG_MAP(CVcsamp1App)
  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.     // Standard file based document commands
  28.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  29.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  30.     // Standard print setup command
  31.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  32. END_MESSAGE_MAP()
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CVcsamp1App construction
  36.  
  37. CVcsamp1App::CVcsamp1App()
  38. {
  39.     // TODO: add construction code here,
  40.     // Place all significant initialization in InitInstance
  41. }
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CVcsamp1App object
  45.  
  46. CVcsamp1App NEAR theApp;
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CVcsamp1App initialization
  50.  
  51. BOOL CVcsamp1App::InitInstance()
  52. {
  53.     // Standard initialization
  54.     // If you are not using these features and wish to reduce the size
  55.     //  of your final executable, you should remove from the following
  56.     //  the specific initialization routines you do not need.
  57.  
  58.     SetDialogBkColor();        // Set dialog background color to gray
  59.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  60.     EnableVBX();               // Initialize VBX support
  61.  
  62.     // Register the application's document templates.  Document templates
  63.     //  serve as the connection between documents, frame windows and views.
  64.  
  65.     CMultiDocTemplate* pDocTemplate;
  66.     pDocTemplate = new CMultiDocTemplate(
  67.         IDR_VCSAMPTYPE,
  68.         RUNTIME_CLASS(CVcsamp1Doc),
  69.         RUNTIME_CLASS(CMDIChildWnd),        // standard MDI child frame
  70.         RUNTIME_CLASS(CVcsamp1View));
  71.     AddDocTemplate(pDocTemplate);
  72.  
  73.     // create main MDI Frame window
  74.     CMainFrame* pMainFrame = new CMainFrame;
  75.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  76.         return FALSE;
  77.     m_pMainWnd = pMainFrame;
  78.  
  79.     // create a new (empty) document
  80.     OnFileNew();
  81.  
  82.     if (m_lpCmdLine[0] != '\0')
  83.     {
  84.         // TODO: add command line processing here
  85.     }
  86.  
  87.     // The main window has been initialized, so show and update it.
  88.     pMainFrame->ShowWindow(m_nCmdShow);
  89.     pMainFrame->UpdateWindow();
  90.  
  91.     return TRUE;
  92. }
  93.  
  94. /////////////////////////////////////////////////////////////////////////////
  95. // CAboutDlg dialog used for App About
  96.  
  97. class CAboutDlg : public CDialog
  98. {
  99. public:
  100.     CAboutDlg();
  101.  
  102. // Dialog Data
  103.     //{{AFX_DATA(CAboutDlg)
  104.     enum { IDD = IDD_ABOUTBOX };
  105.     //}}AFX_DATA
  106.  
  107. // Implementation
  108. protected:
  109.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  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 CVcsamp1App::OnAppAbout()
  137. {
  138.     CAboutDlg aboutDlg;
  139.     aboutDlg.DoModal();
  140. }
  141.  
  142. /////////////////////////////////////////////////////////////////////////////
  143. // VB-Event registration
  144. // (calls to AfxRegisterVBEvent will be placed here by ClassWizard)
  145.  
  146. //{{AFX_VBX_REGISTER_MAP()
  147.     UINT NEAR VBN_TBCHANGED = AfxRegisterVBEvent("TBCHANGED");
  148. //}}AFX_VBX_REGISTER_MAP
  149.  
  150. /////////////////////////////////////////////////////////////////////////////
  151. // CVcsamp1App commands
  152.