home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / VFORM.ZIP / Samples / VfbEx / VfbEx.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-10  |  4.3 KB  |  162 lines

  1. // VfbEx.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "VfbEx.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "ChildFrm.h"
  9. #include "VfbExDoc.h"
  10. #include "VfbExView.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. // CVfbExApp
  20.  
  21. BEGIN_MESSAGE_MAP(CVfbExApp, CWinApp)
  22.     //{{AFX_MSG_MAP(CVfbExApp)
  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. // CVfbExApp construction
  36.  
  37. CVfbExApp::CVfbExApp()
  38. {
  39.     // TODO: add construction code here,
  40.     // Place all significant initialization in InitInstance
  41. }
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CVfbExApp object
  45.  
  46. CVfbExApp theApp;
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CVfbExApp initialization
  50.  
  51. BOOL CVfbExApp::InitInstance()
  52. {
  53.     AfxEnableControlContainer();
  54.  
  55.     AfxOleInit();                // For Drag & Drop
  56.  
  57.     // Standard initialization
  58.     // If you are not using these features and wish to reduce the size
  59.     //  of your final executable, you should remove from the following
  60.     //  the specific initialization routines you do not need.
  61.  
  62. #ifdef _AFXDLL
  63.     Enable3dControls();            // Call this when using MFC in a shared DLL
  64. #else
  65.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  66. #endif
  67.  
  68.     // Change the registry key under which our settings are stored.
  69.     // You should modify this string to be something appropriate
  70.     // such as the name of your company or organization.
  71.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  72.  
  73.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  74.  
  75.     // Register the application's document templates.  Document templates
  76.     //  serve as the connection between documents, frame windows and views.
  77.  
  78.     CMultiDocTemplate* pDocTemplate;
  79.     pDocTemplate = new CMultiDocTemplate(
  80.         IDR_VFBEXTYPE,
  81.         RUNTIME_CLASS(CVfbExDoc),
  82.         RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  83.         RUNTIME_CLASS(CVfbExView));
  84.     AddDocTemplate(pDocTemplate);
  85.  
  86.     // create main MDI Frame window
  87.     CMainFrame* pMainFrame = new CMainFrame;
  88.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  89.         return FALSE;
  90.     m_pMainWnd = pMainFrame;
  91.  
  92.     // Parse command line for standard shell commands, DDE, file open
  93.     CCommandLineInfo cmdInfo;
  94.     ParseCommandLine(cmdInfo);
  95.  
  96.     // Dispatch commands specified on the command line
  97.     // if (!ProcessShellCommand(cmdInfo))
  98.     //     return FALSE;
  99.  
  100.     // The main window has been initialized, so show and update it.
  101.     pMainFrame->ShowWindow(m_nCmdShow);
  102.     pMainFrame->UpdateWindow();
  103.  
  104.     return TRUE;
  105. }
  106.  
  107. /////////////////////////////////////////////////////////////////////////////
  108. // CAboutDlg dialog used for App About
  109.  
  110. class CAboutDlg : public CDialog
  111. {
  112. public:
  113.     CAboutDlg();
  114.  
  115. // Dialog Data
  116.     //{{AFX_DATA(CAboutDlg)
  117.     enum { IDD = IDD_ABOUTBOX };
  118.     //}}AFX_DATA
  119.  
  120.     // ClassWizard generated virtual function overrides
  121.     //{{AFX_VIRTUAL(CAboutDlg)
  122.     protected:
  123.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  124.     //}}AFX_VIRTUAL
  125.  
  126. // Implementation
  127. protected:
  128.     //{{AFX_MSG(CAboutDlg)
  129.         // No message handlers
  130.     //}}AFX_MSG
  131.     DECLARE_MESSAGE_MAP()
  132. };
  133.  
  134. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  135. {
  136.     //{{AFX_DATA_INIT(CAboutDlg)
  137.     //}}AFX_DATA_INIT
  138. }
  139.  
  140. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  141. {
  142.     CDialog::DoDataExchange(pDX);
  143.     //{{AFX_DATA_MAP(CAboutDlg)
  144.     //}}AFX_DATA_MAP
  145. }
  146.  
  147. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  148.     //{{AFX_MSG_MAP(CAboutDlg)
  149.         // No message handlers
  150.     //}}AFX_MSG_MAP
  151. END_MESSAGE_MAP()
  152.  
  153. // App command to run the dialog
  154. void CVfbExApp::OnAppAbout()
  155. {
  156.     CAboutDlg aboutDlg;
  157.     aboutDlg.DoModal();
  158. }
  159.  
  160. /////////////////////////////////////////////////////////////////////////////
  161. // CVfbExApp commands
  162.