#include<afxwin.h>
#define IDB_BUTTON 100
class CButtonApp : public CWinApp
{
public:
virtual int InitInstance();
};
CButtonApp ButtonApp;
class CButtonWindow : public CFrameWnd
{
CButton *button;//
public:
CButtonWindow();
afx_msg void HandleButton();
DECLARE_MESSAGE_MAP()
};
void CButtonWindow::HandleButton()
{
AfxMessageBox("Hello, Your Clicked Button!");
}
BENGIN_MESSAGE_MAP(CButtonWindow,CFrameWnd)
ON_BN_CLICKED(IDB_BUTTON,HandleButton)
END_MESSAGE_MAP()
int CButtonApp::InitInstance()
{
m_pMainWnd=new CButtonWindow();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return 1;
}
CButtonWindow::CButtonWindow()
{
CRect r;
Create(NULL,"CButton Tests!",WS_OVERLAPPEDWINDOW,CRect(0,0,200,200));
GetClientRect(&r);
r.InflateRect(-20,-20);
button=new Button();
button->Create("push me",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,r,this,IDB_BUTTON);
}
我是菜鸟 希望哪位大哥 帮忙看哈上面的程序有什么问题 怎么解决 我是照书上敲得
还是没解决 算了 还是送人吧 不然不白费