CStatusBar statusbar;
static UINT indicators[] =
{
ID_SEPARATOR,
IDS_UserDefStr1,
IDS_UserDefStr2
};
statusbar.Create(this);
statusbar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
int MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );
| Return code/value | Description |
|---|---|
|
The Abort button was selected.
|
|
The Cancel button was selected.
|
|
The Continue button was selected.
|
|
The Ignore button was selected.
|
|
The No button was selected.
|
|
The OK button was selected.
|
|
The Retry button was selected.
|
|
The Try Again button was selected.
|
|
The Yes button was selected.
|
#include <afxwin.h>
#include "resource.h"
class MyFrame : public CFrameWnd
{
private:
CMenu *FMenu;
public:
MyFrame() {
Create(NULL, "Hello MFC-1");
FMenu = new CMenu;
FMenu->LoadMenu(IDR_MENU1);
SetMenu(FMenu);
}
};
class HelloMFC : public CWinApp
{
public:
BOOL InitInstance()
{
CFrameWnd *frame = new MyFrame();
m_pMainWnd = frame;
frame->ShowWindow(SW_SHOW);
return true;
}
};
HelloMFC m_HelloMFC;
====
1. resource.h / IDR_MENU1
建立 resource
設計 Menu 項目
====
執行結果
#include <afxwin.h>
class HelloMFC : public CWinApp
{
public:
BOOL InitInstance()
{
CFrameWnd *frame = new CFrameWnd();
m_pMainWnd = frame;
Frame->Create(NULL, "Hello MFC");
Frame->ShowWindow(SW_SHOW);
return true;
}
};
HelloMFC m_HelloMFC;
| 產品版本 | MFC 版本 |
|---|---|
| Microsoft C/C++ 7.0 | MFC 1.0 |
| Visual C++ 1.0 | MFC 2.0 |
| Visual C++ 1.5 | MFC 2.5 |
| Visual C++ 2.0 | MFC 3.0 |
| Visual C++ 2.1 | MFC 3.1 |
| Visual C++ 2.2 | MFC 3.2 |
| Visual C++ 4.0 | MFC 4.0 (mfc40.dll 包含於 Windows 95) |
| Visual C++ 4.1 | MFC 4.1 |
| Visual C++ 4.2 | MFC 4.2(mfc42.dll 包含於 Windows 98 第一版) |
| Pocket PC Embedded 3.0 | MFC 4.2 (mfc42.dll) |
| Visual C++ 5.0 | MFC 4.21 (mfc42.dll) |
| Visual C++ 6.0 | MFC 6.0 (mfc42.dll) |
| Visual C++ .NET 2002 | MFC 7.0 (mfc70.dll) |
| Visual C++ .NET 2003 | MFC 7.1 (mfc71.dll) |
| Visual C++ 20051 | MFC 8.0 (mfc80.dll) |
| Visual C++ 20081 | MFC 9.0.21022 (mfc90.dll) |
| Visual C++ 2008(包含 Feature Pack)2 | MFC 9.0.30411 (mfc90.dll) |
| Visual C++ 20101 | MFC 10.0.30319.1 (mfc100.dll) |