MFC之Hello World
2014-11-07 18:36
281 查看
头文件hello.h
#pragma once #include <afxwin.h> class CMyApp :public CWinApp { BOOL InitInstance(); }; class CMainWnd :public CFrameWnd { public: CMainWnd(); protected: afx_msg void OnPaint(); DECLARE_MESSAGE_MAP() };实现文件hello.cpp
#include <afxwin.h> #include "Hello.h" CMyApp myApp; BOOL CMyApp::InitInstance() { m_pMainWnd = new CMainWnd; m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); return TRUE; } BEGIN_MESSAGE_MAP(CMainWnd,CFrameWnd) ON_WM_PAINT() END_MESSAGE_MAP() CMainWnd::CMainWnd() { Create(NULL, _T("Hello, MFC")); } void CMainWnd::OnPaint() { CPaintDC dc(this); CRect rect; GetClientRect(&rect); dc.DrawText("Hello World", &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); }
相关文章推荐
- mfc hello world
- 第一个MFC程序“Hello, World!”(vs2008)
- J2ME入门之HelloWorld
- Win32 Application Hello World 详细注释
- JFinal First Demo "Hello World"
- WebService 出现因 URL 意外地以“/HelloWorld”结束,请求格式无法识别。
- HELLO, WORLD
- Apache CXF实战之一 Hello World Web Service
- Hello,World!
- "Hello World"团队召开的第三周第七次会议
- Spring MVC hello world!
- 2012年浙大:Hello World for U
- DWR HelloWorld第一步
- SWT Hello World!!
- 解决insmod: error inserting 'helloworld.ko': -1 Invalid module format
- 林锐书:写一个hello world by seasoned professional
- WTL学习笔记——(2)WTL Hello World !
- COBOL语言编写<hello world>
- java算法求一个字符串的倒序(单词不变输出world the Hello)
- String s = "Hello";s = s + " world!";这两行代码执行后,原始的String对象中的内容到底变了没有?