这个结果不是我想要的》》》》》》》》》》》
#include <afxwin.h>
#include "resource.h"
//#include "Script2.rc"
class MyFrameWindow : public CFrameWnd{
//HMENU hMenu;
public:
afx_msg void OnPaint()//窗口重绘
{
CPaintDC paintDC(this);
paintDC.TextOut(100,100,"这是个窗口程序啊!!");
}
MyFrameWindow::PreCreateWindow(CREATESTRUCT & CS);
DECLARE_MESSAGE_MAP()
};
//消息映射
BEGIN_MESSAGE_MAP(MyFrameWindow,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
//应用程序
MyFrameWindow::PreCreateWindow(CREATESTRUCT & CS)
{
//CS.hMenu =LoadMenu(NULL,MAKEINTRESOURCE(IDR_MENU2));
CFrameWnd::PreCreateWindow(CS);
}
class MyApp: public CWinApp{
public:
MyApp():CWinApp((LPCTSTR)"csongsong")//程序名
{}
BOOL InitInstance()
{
CFrameWnd *MyFrame = new MyFrameWindow;
m_pMainWnd = MyFrame;
MyFrame->Create(NULL,(LPCTSTR)"song");
MyFrame->SetMenu(NULL);
CMenu newMenu;
if( ! newMenu.LoadMenu(MAKEINTRESOURCE(IDR_MENU1)) )
{
::AfxMessageBox("newMenu LoadMenu() failed.");
return 0;
}
MyFrame->SetMenu(&newMenu);
newMenu.Detach();
MyFrame->ShowWindow(SW_SHOW);
return true;
}
} CSong;