重载了按钮类的创建函数,有7个参数。
BOOL CMybutton::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 classreturn CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
我想创建3个按钮,第一个参数是注册的类名称,该怎么填写第一个参数呢?多谢。
pMyButton = new CMybutton;
pMyButton->Create(这里怎么写,"",WS_CHILD|WS_VISIBLE|WS_BORDER, CRect(10,10,100,30), this, 3456);

解决方案 »

  1.   

    pMyButton->Create("", WS_CHILD|WS_VISIBLE|WS_BORDER, CRect(10,10,100,30), this, 3456);
    这样就行
      

  2.   

    第一个参数不用填了
    CButton内部已经给你填上了“Button”
      

  3.   

    第一个参数是BUTTON上显示的字,系统默认的话是BUTTON1吧,
    也可以自己填,比如“测试”,等等
      

  4.   

    第一个参数是按钮上显示的文字,系统没有默认值,如果用""的话,按钮上将什么也不会显示。
    还有记得动态创建的按钮在对话框析构函数中一定要将其Delete,要不然会出错。
      

  5.   

    pMyButton->Create("要在按钮上显示的文字", WS_CHILD|WS_VISIBLE|WS_BORDER, CRect(10,10,100,30), this, 3456);
      

  6.   

    pMyButton->Create("按钮的Caption",WS_CHILD|WS_VISIBLE|WS_BORDER, CRect(10,10,100,30), this, IDC_BUTTONX);