不知道你最后想干什么,或许你应该使用CFormView
CButton* m_pButton;
m_pButton->Create(//记不住了

解决方案 »

  1.   

    生成一个SDI程序,选择从CFormView派生。
    然后
    CButton* m_Button;
    m_Button = new CButton;
    m_pButton->Create("My Button",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 
                       CRect(10,10,100,30), this, 151);
      

  2.   

    在view的OnCreate中,
    CButton btnNew;
    btnNew.Create("Example", WS_CHILD¦WS_VISIBLE¦BS_PUSHBUTTON, 
    CRect(10, 10, 20, 20), this, 给一个ID);
      

  3.   

    如何把画好的按钮显示出来? 你create里面不是指定了CRect了吗?那就是你要放的位置啊!
    this是button所在的窗口,最后你随便指定一个ID就可以了!
      

  4.   

    你派生一个CButton的子类啊!在子类里面指定事件!
      

  5.   

    如何派生一个CButton子类啊?(我真是一个大菜鸟)
      

  6.   

    你得手工添加消息影射了,一句话说不完哪,你用CFormView不就没这么多烦恼了。
    上面yhou31(蓝黑先生) 提到的151其实就是ID值,一般都这样定义#define ID_MYBUTTON 151
    ai~~~~~~~~~
      

  7.   

    自己添加消息呀!!基本上,也就是模仿ClassWizard来添加消息!
    FOR EXAMPLE :
    // button2.cpp
    #include <afxwin.h>
    #define IDC_BUTTON 100
    // Declare the application class
    class CButtonApp : public CWinApp
    {
    public:
    virtual BOOL InitInstance();
    };
    // Create an instance of the application class
    CButtonApp ButtonApp;
    // Declare the main window class
    class CButtonWindow : public CFrameWnd
    {
    CButton *button;
    public:
    CButtonWindow();
    afx_msg void HandleButton();
    DECLARE_MESSAGE_MAP()
    };
    // The message handler function
    void CButtonWindow::HandleButton()
    {
    MessageBeep(0xFFFFFFFF);
    }
    // The message map
    BEGIN_MESSAGE_MAP(CButtonWindow, CFrameWnd)
    ON_BN_CLICKED(IDC_BUTTON, HandleButton)
    END_MESSAGE_MAP()
    // The InitInstance function is called once
    // when the application first executes
    BOOL CButtonApp::InitInstance()
    {
    m_pMainWnd = new CButtonWindow();
    m_pMainWnd->ShowWindow(m_nCmdShow);
    m_pMainWnd->UpdateWindow();
    return TRUE;
    }
    // The constructor for the window class
    CButtonWindow::CButtonWindow()
    {
    CRect r;
    // Create the window itself
    Create(NULL,
    "CButton Tests",
    WS_OVERLAPPEDWINDOW,
    CRect(0,0,200,200));
    // Get the size of the client rectangle
    GetClientRect(&r);
    r.InflateRect(-20,-20);
    // Create a button
    button = new CButton();
    button->Create("Push me",
    WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
    r,
    this,
    IDC_BUTTON);
    }
      

  8.   

    yhou31(蓝黑先生),jeff_hunter(PandaLee),snowwind(异想天开)分以给出。