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

  1. // vfDao.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "vfDao.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "vfDaoDoc.h"
  9. #include "vfDaoView.h"
  10.  
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CVfDaoApp
  19.  
  20. BEGIN_MESSAGE_MAP(CVfDaoApp, CWinApp)
  21.     //{{AFX_MSG_MAP(CVfDaoApp)
  22.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26.     // Standard file based document commands
  27.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  28.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  29.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CVfDaoApp construction
  34.  
  35. CVfDaoApp::CVfDaoApp()
  36. {
  37.     // TODO: add construction code here,
  38.     // Place all significant initialization in InitInstance
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // The one and only CVfDaoApp object
  43.  
  44. CVfDaoApp theApp;
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CVfDaoApp initialization
  48.  
  49. BOOL CVfDaoApp::InitInstance()
  50. {
  51.     AfxEnableControlContainer();
  52.  
  53.     // This registrar is not needed if using VForm::Create
  54.     // VFormRegistrar vfReg;            // Constructor registers vform
  55.  
  56.     // Standard initialization
  57.     // If you are not using these features and wish to reduce the size
  58.     //  of your final executable, you should remove from the following
  59.     //  the specific initialization routines you do not need.
  60.  
  61. #ifdef _AFXDLL
  62.     Enable3dControls();            // Call this when using MFC in a shared DLL
  63. #else
  64.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  65. #endif
  66.  
  67.     // Change the registry key under which our settings are stored.
  68.     // You should modify this string to be something appropriate
  69.     // such as the name of your company or organization.
  70.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  71.  
  72.     LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)
  73.  
  74.     // Register the application's document templates.  Document templates
  75.     //  serve as the connection between documents, frame windows and views.
  76.  
  77.     CSingleDocTemplate* pDocTemplate;
  78.     pDocTemplate = new CSingleDocTemplate(
  79.         IDR_MAINFRAME,
  80.         RUNTIME_CLASS(CVfDaoDoc),
  81.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  82.         RUNTIME_CLASS(CVfDaoView));
  83.     AddDocTemplate(pDocTemplate);
  84.  
  85.     // Parse command line for standard shell commands, DDE, file open
  86.     CCommandLineInfo cmdInfo;
  87.     ParseCommandLine(cmdInfo);
  88.  
  89.     // Open the database
  90.     if(!m_db.EzOpen("movies.mdb"))
  91.     {
  92.         AfxMessageBox("Could Not Open Database:\nmovies.mdb");
  93.         return FALSE;
  94.     }
  95.  
  96.     // Dispatch commands specified on the command line
  97.     if (!ProcessShellCommand(cmdInfo))
  98.         return FALSE;
  99.  
  100.     // The one and only window has been initialized, so show and update it.
  101.     m_pMainWnd->ShowWindow(SW_SHOW);
  102.     m_pMainWnd->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 CVfDaoApp::OnAppAbout()
  155. {
  156.     CAboutDlg aboutDlg;
  157.     aboutDlg.DoModal();
  158. }
  159.  
  160. /////////////////////////////////////////////////////////////////////////////
  161. // CVfDaoApp commands
  162.