win32 Application 模板 建立 MFC程序
2010-02-05 09:29
429 查看
#include <Afxwin.h>
class CMyApp:public CWinApp
{
BOOL InitInstance();
};
class CMyWindow:public CFrameWnd
{
// public:
// CMyWindow();
// ~CMyWindow();
//afx_msg void OnPaint();
public:
void OnPaint();
afx_msg void OnNcPaint( );
DECLARE_MESSAGE_MAP();
};
#include "hello.h"
CMyApp theApp;
BEGIN_MESSAGE_MAP(CMyWindow,CFrameWnd)
ON_WM_PAINT()
ON_WM_NCPAINT()
END_MESSAGE_MAP()
CMyApp::InitInstance()
{
CMyWindow *MainWnd = new CMyWindow;
MainWnd->Create(NULL,"llsls");
m_pMainWnd = MainWnd;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
// ::MessageBox(0,"Hello","Simple MFC",MB_OK);
return true;
}
void CMyWindow::OnPaint()
{
CClientDC pDC(this);
CRect rc;
GetClientRect(&rc);
PAINTSTRUCT ps;
//BeginPaint(&ps);
//pDC.SetBkColor(TRANSPARENT);
//pDC.Rectangle(CRect(0, 0, 100, 100));
pDC.DrawText(_T("hello,world"),&rc,DT_SINGLELINE | DT_CENTER | DT_VCENTER );
// EndPaint(&ps);
// ReleaseDC(pDC);
CFrameWnd::OnPaint();
}
void CMyWindow::OnNcPaint()
{
// CDC *pDC = GetWindowDC();
// CRect rc;
// // GetClientRect(&rc);
// pDC->Rectangle(CRect(0, 0, 100, 100));
// ReleaseDC(pDC);
//dc.DrawText(_T("hello,world"),&rc,DT_SINGLELINE | DT_CENTER | DT_VCENTER );
}
// CMyWindow::CMyWindow()
// {
//
//
// }
class CMyApp:public CWinApp
{
BOOL InitInstance();
};
class CMyWindow:public CFrameWnd
{
// public:
// CMyWindow();
// ~CMyWindow();
//afx_msg void OnPaint();
public:
void OnPaint();
afx_msg void OnNcPaint( );
DECLARE_MESSAGE_MAP();
};
#include "hello.h"
CMyApp theApp;
BEGIN_MESSAGE_MAP(CMyWindow,CFrameWnd)
ON_WM_PAINT()
ON_WM_NCPAINT()
END_MESSAGE_MAP()
CMyApp::InitInstance()
{
CMyWindow *MainWnd = new CMyWindow;
MainWnd->Create(NULL,"llsls");
m_pMainWnd = MainWnd;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
// ::MessageBox(0,"Hello","Simple MFC",MB_OK);
return true;
}
void CMyWindow::OnPaint()
{
CClientDC pDC(this);
CRect rc;
GetClientRect(&rc);
PAINTSTRUCT ps;
//BeginPaint(&ps);
//pDC.SetBkColor(TRANSPARENT);
//pDC.Rectangle(CRect(0, 0, 100, 100));
pDC.DrawText(_T("hello,world"),&rc,DT_SINGLELINE | DT_CENTER | DT_VCENTER );
// EndPaint(&ps);
// ReleaseDC(pDC);
CFrameWnd::OnPaint();
}
void CMyWindow::OnNcPaint()
{
// CDC *pDC = GetWindowDC();
// CRect rc;
// // GetClientRect(&rc);
// pDC->Rectangle(CRect(0, 0, 100, 100));
// ReleaseDC(pDC);
//dc.DrawText(_T("hello,world"),&rc,DT_SINGLELINE | DT_CENTER | DT_VCENTER );
}
// CMyWindow::CMyWindow()
// {
//
//
// }
相关文章推荐
- MFC学习之二:建立一个对话框程序
- 在MFC,Win32程序中向控制台(Console)窗口输出调试信息
- VS2005下不用向导建立MFC程序
- VS2012编译出来的程序,在XP上运行,出现“.exe 不是有效的 win32 应用程序” “not a valid win32 application”
- MFC,Win32程序向控制台(Console)窗口输出调试信息
- MFC之基于对话框的Win32程序
- VC: Win32 Application和Win32 Console Application、MFC APPWIZARD区别
- <<深入浅出MFC>>笔记1——Win32基本程序观念
- win32窗口程序建立用户界面线程
- 魔改——MFC MDI程序 定制 文档模板 运行时全部打开 禁用关闭按钮
- 在WIn32程序中使用MFC的CInternetSession运行异常,主要是因为获取目前应用程序名出错的解决办法
- 多文档、多模板程序建立新的子框架类后,出现“建立空文档失败”问题的解决办法
- 实现 Win32 程序的消息映射宏(类似 MFC )
- Win32 Application和Win32 Console Application、MFC APPWIZARD区别
- 在MFC,Win32程序中向控制台(Console)窗口输出调试信息
- MFC程序和Win32程序的关系
- Win32模板程序
- MFC学习笔记1--Win32基本程序观念
- VS2010下建立MFC程序
- win32控制台程序中,使用MFC的方法