程式語言 - Visual C++ 6.0 - Microsoft Fundation Class (MFC) - Dialog - Create Window



main.cpp

#include <afxwin.h>
#include "res.h"
 
class CMyDlg : public CDialog
{
public:
    CMyDlg();
    enum { IDD = IDD_MAIN_DIALOG };
};
    
CMyDlg::CMyDlg() : CDialog(CMyDlg::IDD)
{
}
 
class CMyApp : public CWinApp
{
public:
    BOOL InitInstance();
};
 
CMyApp theApp;

BOOL CMyApp::InitInstance()
{
    CMyDlg dlg;

    m_pMainWnd = &dlg;
    dlg.DoModal();
    return FALSE;
}

main.rc

#include "res.h"
#include "afxres.h"

IDD_MAIN_DIALOG DIALOGEX  0, 0, 150, 100 
STYLE DS_MODALFRAME | WS_VISIBLE
EXSTYLE WS_EX_APPWINDOW
CAPTION "main"
FONT 8, "MS Sans Serif"
BEGIN
END

res.h

#define IDD_MAIN_DIALOG 101

編譯、執行

$ export WINEPREFIX=/home/user/.wine_x86

$ box86 wine nmake -f main.mak

完成