Annotation of mstools/mfc/samples/ctrltest/ctrltest.cpp, revision 1.1

1.1     ! root        1: // ctrltest.cpp : Dialogs and Controls test applet
        !             2: //
        !             3: // This is a part of the Microsoft Foundation Classes C++ library.
        !             4: // Copyright (C) 1992 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 Microsoft
        !             9: // QuickHelp documentation provided with the library.
        !            10: // See these sources for detailed information regarding the
        !            11: // Microsoft Foundation Classes product.
        !            12: 
        !            13: #include "ctrltest.h"
        !            14: 
        !            15: /////////////////////////////////////////////////////////////////////////////
        !            16: // Main Window
        !            17: 
        !            18: BEGIN_MESSAGE_MAP(CTestWindow, CFrameWnd)
        !            19:        ON_COMMAND(IDM_EXIT, OnExit)
        !            20:        ON_COMMAND(IDM_ABOUT, OnAbout)
        !            21:        // simple
        !            22:        ON_COMMAND(IDM_TEST_DERIVED_EDIT, OnTestDerivedEdit)
        !            23:        ON_COMMAND(IDM_TEST_WNDCLASS_EDIT, OnTestWndClassEdit)
        !            24:        ON_COMMAND(IDM_TEST_SUB_EDIT, OnTestSubclassedEdit)
        !            25: #ifndef _NTWIN
        !            26:        // pen
        !            27:        ON_COMMAND(IDM_TEST_PENEDIT_CODE, OnTestPenEditFromCode)
        !            28:        ON_COMMAND(IDM_TEST_PENEDIT_TEMPLATE, OnTestPenEditFromTemplate)
        !            29:        ON_COMMAND(IDM_TEST_PENEDIT_FEATURES, OnTestPenEditFeatures)
        !            30: #endif
        !            31:        // custom
        !            32:        ON_COMMAND(IDM_TEST_BITMAP_BUTTON1, OnTestBitmapButton1)
        !            33:        ON_COMMAND(IDM_TEST_BITMAP_BUTTON2, OnTestBitmapButton2)
        !            34:        ON_COMMAND(IDM_TEST_CUSTOM_LIST, OnTestCustomList)
        !            35:        ON_COMMAND(IDM_TEST_SPIN_EDIT, OnTestSpinEdit)
        !            36: END_MESSAGE_MAP()
        !            37: 
        !            38: void CTestWindow::SetupMenus()
        !            39: {
        !            40:        if ((GetSystemMetrics(SM_PENWINDOWS)) == NULL)
        !            41:        {
        !            42:                CMenu* pMenu = GetMenu();
        !            43:                ASSERT(pMenu != NULL);
        !            44:                pMenu->EnableMenuItem(IDM_TEST_PENEDIT_CODE, MF_DISABLED|MF_GRAYED);
        !            45:                pMenu->EnableMenuItem(IDM_TEST_PENEDIT_TEMPLATE, MF_DISABLED|MF_GRAYED);
        !            46:                pMenu->EnableMenuItem(IDM_TEST_PENEDIT_FEATURES, MF_DISABLED|MF_GRAYED);
        !            47:        }
        !            48:        // do not test for spin control until the user tries it
        !            49:        // if the custom control DLL is not present, the test spin
        !            50:        //  control menu item will be disabled in 'OnTestSpinEdit'.
        !            51: 
        !            52:        // custom menu tests
        !            53:        AttachCustomMenu();
        !            54: }
        !            55: 
        !            56: void CTestWindow::OnExit()
        !            57: {
        !            58:        SendMessage(WM_CLOSE);
        !            59: }
        !            60: 
        !            61: void CTestWindow::OnAbout()
        !            62: {
        !            63:        CModalDialog dlg(IDD_ABOUT);
        !            64:        dlg.DoModal();
        !            65: }
        !            66: 
        !            67: 
        !            68: /////////////////////////////////////////////////////////////////////////////
        !            69: // Application class
        !            70: 
        !            71: class CTestApp : public CWinApp
        !            72: {
        !            73: protected:
        !            74:        CTestWindow m_window;
        !            75:                // instead of allocating a new main window, you can embed it
        !            76:                //   if you like
        !            77: public:
        !            78:        virtual BOOL InitInstance();
        !            79: };
        !            80: 
        !            81: CTestApp theTestApp;
        !            82: 
        !            83: BOOL CTestApp::InitInstance()
        !            84: {
        !            85:        if (!m_window.Create(NULL, "Control Test App",
        !            86:          WS_OVERLAPPEDWINDOW, CFrameWnd::rectDefault, NULL,
        !            87:          MAKEINTRESOURCE(AFX_IDI_STD_FRAME)/*menu*/))
        !            88:                return FALSE;
        !            89: 
        !            90:        m_pMainWnd = &m_window;
        !            91:        m_window.SetupMenus();
        !            92:        m_window.ShowWindow(m_nCmdShow);
        !            93:        return TRUE;
        !            94: }
        !            95: 
        !            96: void CTestWindow::PostNcDestroy()
        !            97: {
        !            98:        // don't delete this
        !            99: }
        !           100: 
        !           101: /////////////////////////////////////////////////////////////////////////////

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.