??? derived CDialogBar ??? ?????? ?????????? ?? ??????? ???? ?? ??? ???? ????

???? ?????? ???? ??????
???? ID: 185672 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

??????

?? ?????? CDialogBar, ???? CButtons MFC ?? ?????? ???????????, ?? ??? ?? ?? ???? ????? ??? ?? ?????? ???? ?? ??????? CControlBar ?? ?????? ?? ??? ?????? ???????? ????? ????? ????? ?? CDialogBar derive ???? ?? ????

??? ??, ?? ???? ???? CDialogBar, ?????-???? ?????? ?????, ?? treeview ?? ActiveX ???????? ?? ?? ???? ??, ?? ?? ????? ??? ?? ?? ?????? ???????? ?? ??? ????????? ?????? ???? ?? ??? CDialogBar ?? derive ???? ?? ??? ?????? ???

??????? ClassWizard CDialogBar ?? ?? ???? ?? deriving ?? ?????? ???? ????, ?? ?? ???? ?????? ??? CDialog ?? ?? ???? ?? ????? ?? ???? ??? "" ???? ??? ?????? ???? CDialogBar ???? ?? ??? ?????? ???

???? ???????

??????? ???? ?? ??? ??? CDialog ???? ?????? ?????????? ?? ????? ???? ????? ??? ?? ??? ?????? ?? ????? ????? ?? ????? ?? ???? CDialogBar ???? ??? CDialog ???? transform ?? ???? ??:

  1. ???? ???? ?? ??? CDialog CDialogBar ???? ?? ??? ???? declaration ???? ?? ???? ???? ??? BEGIN_MESSAGE_MAP .cpp ????? ??? ????????? ???? ?? ??? ???? ??? ???
  2. Constructor .h ?? .cpp ??????? ??? ????????? ????? ?? DoDataExchange() ???? ?? ??? ????????? ????? ???? ????????? ???? ?? ??? ??? ???? ????

    ????? ??? ?? ?????
          CMyDlgBar (CWnd* pParent = NULL);   // standard constructor
    
          CMyDlgBar:: CMyDlgBar (CWnd* pParent /*=NULL*/)
             : CDialog(CMyDlgBar::IDD, pParent)
          {
             ...
    
          void CMyDlgBar::DoDataExchange(CDataExchange* pDX)
          {
             CDialog::DoDataExchange(pDX);
             ...
    					
    ?????:
          CMyDlgBar ();   // standard constructor
    
          CMyDlgBar:: CMyDlgBar ()
          {
             ...
    
          void CMyDlgBar::DoDataExchange(CDataExchange* pDX)
          {
             CDialogBar::DoDataExchange(pDX);
             ...
    					
    ???????? ???? ?? ??? ????? ?? OnInitDialog ???? ?? ??? ?? ?? ON_MESSAGE() ?????? ?????? WM_INITDIALOG ????? ??? ?? ?? ???? ??????? OnInitDialog() ????? ?????? ?? ???????? ??? ?? ???? ?? ?? ???? ??????? OnInitDialog() ?? ???? ??? ??? ????, ?? ??? ???? ?? ???? ?? ???????
  3. "??????? BOOL OnInitDialog();" ?? ????? ?? ???? ????? ??? ?? ?????? "afx_msg ???? OnInitDialog (UINT, ????);" ???? ????? ??? ?????? ?? ???::
          class CMyDlgBar : public CDialogBar
          {
             ...
          // Implementation
          protected:
    
             // Generated message map functions
             //{{AFX_MSG(CMyDlgBar)
             virtual BOOL OnInitDialog();                // <-Remove this line.
             //}}AFX_MSG
    
             afx_msg LONG OnInitDialog ( UINT, LONG );   // <-Add this line.
             DECLARE_MESSAGE_MAP()
          };
    						
    ??, ???? ??????????? ??? ??? ??????? ???????? ?????
  4. "(WM_INITDIALOG, OnInitDialog); ON_MESSAGE" ?????? .CPP ??????????? ????? ??? ????? ??? ???? ?? ???? ?????? ?? ???::
          BEGIN_MESSAGE_MAP(CMyDlgBar, CDialogBar)
    
             //{{AFX_MSG_MAP(CMyDlgBar)
             ...
             //}}AFX_MSG_MAP
             ON_MESSAGE(WM_INITDIALOG, OnInitDialog )    // <-- Add this line.
          END_MESSAGE_MAP()
    						
    ??, ????? ??? OnInitDialog() ???? ?? ??? ??????? OnInitDialog() ??? ?????? ?????
  5. OnInitDialog() ??????? ??????????? ????:
       Change the following:
    
          BOOL CMyDlgBar::OnInitDialog()
          {
             CDialog::OnInitDialog();   // <-- Replace this line:
                ...
    						
    ?????:
    LONG CMyDlgBar::OnInitDialog ( UINT wParam, LONG lParam)
             {
                              // <-- with these lines. -->
    
                BOOL bRet = HandleInitDialog(wParam, lParam);
    
                if (!UpdateData(FALSE))
                {
                   TRACE0("Warning: UpdateData failed during dialog init.\n");
                }
                ...
    
                return bRet;
    						
    CDialogBar ???? ???? ??????? OnInitDialog() ?? ??? ???? ??, ?? ????? ?? ??? ??? ???? ????? UpdateData subclass ???? ?? ??? ??? ???? ??, ?? ??? ?????? ?????????? ?? ??????? ?????
  6. ????????? ???? ?? ????? ????? ?????? ??????? ????? ???? ?? ???:
    ????: ??????
    Boarder: ??? ????
    ????? ???? ????: ????????
    ?? ????? ??, ?? ??? ???????? CDialog ?? ?? ???? ?? ??? CDialogBar ???? ?? ??? ??? ?? ??? ???? ?? ??? reconnected ???? ??? ??? ??, ????? ?? ??? ?? ????? ?????
  7. (???? CMainFrame ??????? ??? ?? ??? ???? ??) CframeWnd ??? ???? ?? ??? derived CDialogBar ?? ??????? ?? ??????? ?????? ?? ???::
          class CMainFrame : public CFrameWnd
          {
              ...
              CMyDlgBar m_myDlgBar;
              ...
          };
    					
  8. ??? create ???? CFrameWnd::OnCreate() ?????? ??? m_myDlgBar ?? ?? ??? ????? ?? ???? ???? ??:
          int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
          {
             ...
             if (!m_myDlgBar.Create(this, IDD_DLGBAR1, CBRS_LEFT,
                IDD_DLGBAR1))
             {
                TRACE0("Failed to create dialog bar\n");
                return -1;      // fail to create
             }
             ...
          }
    					
  9. ???, ??? ?? ???????? ?????? ?? CDialogBar ?? ?? ???? ????? ?? ?????? ???? ????? ???, ?? ????? ????? ????????? CMainFrame::OnCreate() ?? ??? ???? ?? ???:
          int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
          {
             ...
             m_myDlgBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
                CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
             m_myDlgBar.EnableDocking(CBRS_ALIGN_ANY);
             DockControlBar(&m_myDlgBar);
    
             return 0;
          }

??????

???? ??????? ?? ???, Microsoft ?????? ??? ??? ???? ????? ?? ??? ????? ???? ?????? ????? ????::
99161ClassWizard ??? ???????? ???? ???? ?? derive ???? ????

???

???? ID: 185672 - ????? ???????: 03 ?????? 2010 - ??????: 4.0
???? ???? ???? ??:
  • Microsoft Foundation Class Library 4.2, ?? ???? ??? ?????? ???? ???:
    • Microsoft Visual C++ 5.0 Enterprise Edition
    • Microsoft Visual C++ 5.0 Professional Edition
??????: 
kbhowto kbmfcctrlbar kbuidesign kbwizard kbmt KB185672 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:185672

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com