home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / wcedbtst / wcedbtst.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  3.9 KB  |  149 lines

  1. // WCE_Database.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6. #include "wcedbtst.h"
  7. #include "MainFrm.h"
  8. #include "wcedbdoc.h"
  9. #include "wcedbvw.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. // CWCEDBApp
  19.  
  20. BEGIN_MESSAGE_MAP(CWCEDBApp, CWinApp)
  21.     //{{AFX_MSG_MAP(CWCEDBApp)
  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. END_MESSAGE_MAP()
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // The one and only CWCEDBApp object
  33.  
  34. // WCE MFC apps require the application name to be specified in the CWinApp 
  35. // constructor. A help contents filename may also be specified.
  36.  
  37. CWCEDBApp theApp;
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CWCEDBApp initialization
  41.  
  42. BOOL CWCEDBApp::InitInstance()
  43. {
  44.     // Standard initialization
  45.     // If you are not using these features and wish to reduce the size
  46.     //  of your final executable, you should remove from the following
  47.     //  the specific initialization routines you do not need.
  48.  
  49.     // Change the registry key under which our settings are stored.
  50.     // You should modify this string to be something appropriate
  51.     // such as the name of your company or organization.
  52.     CString str;
  53.     str.LoadString(IDS_REGISTRATION);
  54.     SetRegistryKey((LPCTSTR)str);
  55.  
  56.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  57.  
  58.     // Register the application's document templates.  Document templates
  59.     //  serve as the connection between documents, frame windows and views.
  60.  
  61.     CSingleDocTemplate* pDocTemplate;
  62.     pDocTemplate = new CSingleDocTemplate(
  63.         IDR_MAINFRAME,
  64.         RUNTIME_CLASS(CWCEDBDoc),
  65.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  66.         RUNTIME_CLASS(CWCEDBView));
  67.     AddDocTemplate(pDocTemplate);
  68.  
  69.     // Parse command line for standard shell commands, DDE, file open
  70.     CCommandLineInfo cmdInfo;
  71.     ParseCommandLine(cmdInfo);
  72.  
  73.     // Dispatch commands specified on the command line
  74.     if (!ProcessShellCommand(cmdInfo))
  75.         return FALSE;
  76.  
  77.     // The one and only window has been initialized, so show and update it.
  78.     m_pMainWnd->ShowWindow(SW_SHOW);
  79.     m_pMainWnd->UpdateWindow();
  80.  
  81.     return TRUE;
  82. }
  83.  
  84. /////////////////////////////////////////////////////////////////////////////
  85. // CAboutDlg dialog used for App About
  86.  
  87. class CAboutDlg : public CDialog
  88. {
  89. public:
  90.     CAboutDlg();
  91.  
  92. // Dialog Data
  93.     //{{AFX_DATA(CAboutDlg)
  94.     enum { IDD = IDD_ABOUTBOX };
  95.     //}}AFX_DATA
  96.  
  97.     // ClassWizard generated virtual function overrides
  98.     //{{AFX_VIRTUAL(CAboutDlg)
  99.     protected:
  100.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  101.     //}}AFX_VIRTUAL
  102.  
  103. // Implementation
  104. protected:
  105.     //{{AFX_MSG(CAboutDlg)
  106.     virtual BOOL OnInitDialog();
  107.     //}}AFX_MSG
  108.     DECLARE_MESSAGE_MAP()
  109. };
  110.  
  111. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  112. {
  113.     //{{AFX_DATA_INIT(CAboutDlg)
  114.     //}}AFX_DATA_INIT
  115. }
  116.  
  117. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  118. {
  119.     CDialog::DoDataExchange(pDX);
  120.     //{{AFX_DATA_MAP(CAboutDlg)
  121.     //}}AFX_DATA_MAP
  122. }
  123.  
  124. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  125.     //{{AFX_MSG_MAP(CAboutDlg)
  126.         // No message handlers
  127.     //}}AFX_MSG_MAP
  128. END_MESSAGE_MAP()
  129.  
  130. // App command to run the dialog
  131. void CWCEDBApp::OnAppAbout()
  132. {
  133.     CAboutDlg aboutDlg;
  134.     aboutDlg.DoModal();
  135. }
  136.  
  137. /////////////////////////////////////////////////////////////////////////////
  138. // CWCEDBApp commands
  139.  
  140. BOOL CAboutDlg::OnInitDialog() 
  141. {
  142.     CDialog::OnInitDialog();
  143.     
  144.     CenterWindow();
  145.     
  146.     return TRUE;  // return TRUE unless you set the focus to a control
  147.                   // EXCEPTION: OCX Property Pages should return FALSE
  148. }
  149.