main.cpp
#include <afxwin.h>
#define ID_TEST 100
class CMyFrame : public CFrameWnd
{
public:
CMyFrame();
DECLARE_MESSAGE_MAP()
protected:
afx_msg void OnTest();
private:
CButton m_Button;
};
BEGIN_MESSAGE_MAP(CMyFrame, CFrameWnd)
ON_COMMAND(ID_TEST, OnTest)
END_MESSAGE_MAP()
void CMyFrame::OnTest()
{
AfxMessageBox("Test");
}
CMyFrame::CMyFrame()
{
Create(NULL, "main", WS_VISIBLE, CRect(0, 0, 300, 300));
m_Button.Create("Test", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(50, 50, 100, 100), this, ID_TEST);
}
class CMyApp : public CWinApp
{
public:
BOOL InitInstance();
};
CMyApp myApp;
BOOL CMyApp::InitInstance()
{
CMyFrame *pFrame = new CMyFrame;
m_pMainWnd = pFrame;
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
return TRUE;
}
編譯、執行
$ export WINEPREFIX=/home/user/.wine_x86 $ box86 wine nmake -f main.mak
完成
