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

  1. // ctrltest.cpp : Dialogs and Controls test applet
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1999 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "ctrltest.h"
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // Main Window
  18.  
  19. // The OnTest routines are in the source files containing the particular
  20. // dialog that they are working with.  For example OnTestDerivedEdit is
  21. // in file dertest.cpp
  22.  
  23. BEGIN_MESSAGE_MAP(CTestWindow, CFrameWnd)
  24.     //{{AFX_MSG_MAP(CTestWindow)
  25.     ON_COMMAND(IDM_TEST_DERIVED_EDIT, OnTestDerivedEdit)
  26.     ON_COMMAND(IDM_TEST_SUB_EDIT, OnTestSubclassedEdit)
  27.     ON_COMMAND(IDM_TEST_BITMAP_BUTTON1, OnTestBitmapButton1)
  28.     ON_COMMAND(IDM_TEST_BITMAP_BUTTON2, OnTestBitmapButton2)
  29.     ON_COMMAND(IDM_TEST_BITMAP_BUTTON3, OnTestBitmapButton3)
  30.     ON_COMMAND(IDM_TEST_SPIN_EDIT, OnTestSpinEdit)
  31.     //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33.  
  34. BEGIN_MESSAGE_MAP(CTestApp, CWinApp)
  35.     //{{AFX_MSG_MAP(CTestApp)
  36.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  37.     //}}AFX_MSG_MAP
  38. END_MESSAGE_MAP()
  39.  
  40. CTestApp theTestApp;
  41.  
  42. BOOL CTestApp::InitInstance()
  43. {
  44.     CTestWindow* pMainWnd = new CTestWindow;
  45.     if (!pMainWnd->Create(NULL, CString((LPCTSTR)IDS_CTRLTSTAPP),
  46.         WS_VISIBLE, CFrameWnd::rectDefault, NULL,
  47.         MAKEINTRESOURCE(AFX_IDI_STD_FRAME)/*menu*/))
  48.         return FALSE;
  49.  
  50.     // Add 'X' adornment to the command bar
  51.     // For MFCCE 2.0 and earlier, a command bar was created during
  52.     // the CFrameWnd creation. For MFCCE 2.01 and later, a command bar 
  53.     // is automatically created for you during the call to AddAdornments().
  54.     pMainWnd->AddAdornments(0);
  55.  
  56.     pMainWnd->ShowWindow(m_nCmdShow);
  57.     m_pMainWnd = pMainWnd;      // store in CWinApp member
  58.     return TRUE;
  59. }
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62. /////////////////////////////////////////////////////////////////////////////
  63. // CAboutDlg dialog
  64.  
  65. class CAboutDlg : public CDialog
  66. {
  67. // Construction
  68. public:
  69.     CAboutDlg(CWnd* pParent = NULL);   // standard constructor
  70.  
  71. // Dialog Data
  72.     //{{AFX_DATA(CAboutDlg)
  73.     enum { IDD = IDD_ABOUTBOX };
  74.         // NOTE: the ClassWizard will add data members here
  75.     //}}AFX_DATA
  76.  
  77.  
  78. // Overrides
  79.     // ClassWizard generated virtual function overrides
  80.     //{{AFX_VIRTUAL(CAboutDlg)
  81.     protected:
  82.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  83.     //}}AFX_VIRTUAL
  84.  
  85. // Implementation
  86. protected:
  87.  
  88.     // Generated message map functions
  89.     //{{AFX_MSG(CAboutDlg)
  90.     virtual BOOL OnInitDialog();
  91.     //}}AFX_MSG
  92.     DECLARE_MESSAGE_MAP()
  93. };
  94. /////////////////////////////////////////////////////////////////////////////
  95. // CAboutDlg dialog
  96.  
  97.  
  98. CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
  99.     : CDialog(CAboutDlg::IDD, pParent)
  100. {
  101.     //{{AFX_DATA_INIT(CAboutDlg)
  102.         // NOTE: the ClassWizard will add member initialization here
  103.     //}}AFX_DATA_INIT
  104. }
  105.  
  106.  
  107. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  108. {
  109.     CDialog::DoDataExchange(pDX);
  110.     //{{AFX_DATA_MAP(CAboutDlg)
  111.         // NOTE: the ClassWizard will add DDX and DDV calls here
  112.     //}}AFX_DATA_MAP
  113. }
  114.  
  115.  
  116. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  117.     //{{AFX_MSG_MAP(CAboutDlg)
  118.     //}}AFX_MSG_MAP
  119. END_MESSAGE_MAP()
  120.  
  121. /////////////////////////////////////////////////////////////////////////////
  122. // CAboutDlg message handlers
  123.  
  124. BOOL CAboutDlg::OnInitDialog() 
  125. {
  126.     CDialog::OnInitDialog();
  127.     CenterWindow();    
  128.     return TRUE;  
  129. }
  130.  
  131. void CTestApp::OnAppAbout()
  132. {
  133.     CAboutDlg about;
  134.     about.DoModal();
  135. }
  136.