Compartilhar via


CDialogBar::Create

Loads the dialog-box resource template specified by lpszTemplateName or nIDTemplate, creates the dialog-bar window, sets its style, and associates it with the CDialogBar object.

virtual BOOL Create( 
   CWnd* pParentWnd, 
   LPCTSTR lpszTemplateName, 
   UINT nStyle, 
   UINT nID  
); 
virtual BOOL Create( 
   CWnd* pParentWnd, 
   UINT nIDTemplate, 
   UINT nStyle, 
   UINT nID  
);

Parameters

  • pParentWnd
    A pointer to the parent CWnd object.

  • lpszTemplateName
    A pointer to the name of the CDialogBar object's dialog-box resource template.

  • nStyle
    The toolbar style. Additional toolbar styles supported are:

    • CBRS_TOP   Control bar is at top of the frame window.

    • CBRS_BOTTOM   Control bar is at bottom of the frame window.

    • CBRS_NOALIGN   Control bar is not repositioned when the parent is resized.

    • CBRS_TOOLTIPS   Control bar displays tool tips.

    • CBRS_SIZE_DYNAMIC   Control bar is dynamic.

    • CBRS_SIZE_FIXED   Control bar is fixed.

    • CBRS_FLOATING   Control bar is floating.

    • CBRS_FLYBY   Status bar displays information about the button.

    • CBRS_HIDE_INPLACE   Control bar is not displayed to the user.

  • nID
    The control ID of the dialog bar.

  • nIDTemplate
    The resource ID of the CDialogBar object's dialog-box template.

Return Value

Nonzero if successful; otherwise 0.

Remarks

If you specify the CBRS_TOP or CBRS_BOTTOM alignment style, the dialog bar's width is that of the frame window and its height is that of the resource specified by nIDTemplate. If you specify the CBRS_LEFT or CBRS_RIGHT alignment style, the dialog bar's height is that of the frame window and its width is that of the resource specified by nIDTemplate.

Example

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
      return -1;

   EnableDocking(CBRS_ALIGN_ANY);

   // m_wndDlgBar is a CDialogBar member of CMainFrame 
   // IDD_DIALOGBAR - Resource ID of the dialog  
   // template. This dialog template should be created  
   // with  the  style  WS_CHILD and no other style. 
   // The template must not have the style WS_VISIBLE. 
   if (!m_wndDlgBar.Create(this, IDD_DIALOGBAR,
      CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY, IDD_DIALOGBAR))
   {
      TRACE0("Failed to create DlgBar\n");
      return -1;      // Fail to create.
   }

   return 0;
}

Requirements

Header: afxext.h

See Also

Reference

CDialogBar Class

Hierarchy Chart

CDialogBar::CDialogBar