我在做的界面右面有一个工具栏,派生自CDialog,是自定义的,它上面有一些单选框之类的选项按钮,在编辑资源时,它是IDD_DIALOGBAR。它的构造孙数是
CMyDialog::CMyDialog(CWnd* pParent /*=NULL*/)
: CDialog(CMyDialog::IDD, pParent)BOOL CMyDialog::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, 
CCreateContext* pContext) 
{
// TODO: Add your specialized code here and/or call the base class

return CDialog::Create(IDD, pParentWnd);
}
可是我不会用它的Creat函数,它后面带的参数我都查不到。请诸位高手帮帮忙。

解决方案 »

  1.   

    没有见过你那样的创建对话框方式
    创建对话框CreateDialog
    The CreateDialog macro creates a modeless dialog box from a dialog box template resource. The CreateDialog macro uses the CreateDialogParam function.HWND CreateDialog(
      HINSTANCE hInstance,  // handle to module
      LPCTSTR lpTemplate,   // dialog box template name
      HWND hWndParent,      // handle to owner window
      DLGPROC lpDialogFunc  // dialog box procedure
    );或者CDialog::CDialog 
    To construct a resource-based modal dialog box, call either public form of the constructorvirtual BOOL Create(
       LPCTSTR lpszTemplateName,   
       CWnd* pParentWnd = NULL 
    );
    virtual BOOL Create(
       UINT nIDTemplate,
       CWnd* pParentWnd = NULL 
    );
    Parameters
    lpszTemplateName 
    Contains a null-terminated string that is the name of a dialog-box template resource. 
    pParentWnd 
    Points to the parent window object (of type CWnd) to which the dialog object belongs. If it is NULL, the dialog object's parent window is set to the main application window. 
    nIDTemplate 
    Contains the ID number of a dialog-box template resource.
      

  2.   

    看看CreateWindow 的参数就知道了,基本上大同小异。
    pszClassName 是创建的类名
    lpszWindowName 窗口名称
    dwStyle        窗口样式
    rect           窗口大小
    pParentWnd     父窗口句柄
    nID            资源库的模板
    pContext       帮助上下文
      

  3.   

    谢谢以上几位的回答,是我搞错了,我要做的是一个DialogBar,放在主框架的右侧,我在主框架内直接用CDialogBar m_DlgBar,就可以了。在DialogBar上还有三个单选按钮、一个EditBox和一个ScrollBar。三个单选按钮是成组的,请问我应该如何去定义和使用它?
      

  4.   

    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (!m_DlgBar.Create(this, IDD_DIALOG1, 
    CBRS_RIGHT, AFX_IDW_DIALOGBAR))
    {
    TRACE0("Failed to create dialogbar\n");
    return -1; // fail to create
    }
    ...
    }