zoukankan      html  css  js  c++  java
  • First MFC

    // stdafx.h : include file for standard system include files,
    //  or project specific include files that are used frequently, but
    //      are changed infrequently
    //
    
    #if !defined(AFX_STDAFX_H__A3DDEB0A_0CE3_44DE_9AD8_B5AD12758B55__INCLUDED_)
    #define AFX_STDAFX_H__A3DDEB0A_0CE3_44DE_9AD8_B5AD12758B55__INCLUDED_
    
    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    
    #define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers
    
    #include <afxwin.h>         // MFC core and standard components
    #include <afxext.h>         // MFC extensions
    #include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
    #ifndef _AFX_NO_AFXCMN_SUPPORT
    #include <afxcmn.h>			// MFC support for Windows Common Controls
    #endif // _AFX_NO_AFXCMN_SUPPORT
    
    
    //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
    
    #endif // !defined(AFX_STDAFX_H__A3DDEB0A_0CE3_44DE_9AD8_B5AD12758B55__INCLUDED_)
    
    
    /************************************************************/
    // stdafx.cpp : source file that includes just the standard includes
    //	HelloMFC.pch will be the pre-compiled header
    //	stdafx.obj will contain the pre-compiled type information
    
    #include "stdafx.h"
    
    /************************************************************/
    //FileName: hello.h
    
    class CMyApp : public CWinApp
    {
    public:
    	virtual BOOL InitInstance();		
    };
    
    class CMainWindow : public CFrameWnd
    {
    public:
    	CMainWindow();
    protected:
    	afx_msg void OnPaint();
    	DECLARE_MESSAGE_MAP()
    };
    
    
    /************************************************************/
    //FileName: Hello.cpp
    
    #include "StdAfx.h"
    #include "Hello.h"
    
    CMyApp myApp;
    
    //CMyApp
    BOOL CMyApp::InitInstance(){
    	this->m_pMainWnd = new CMainWindow;
    	this->m_pMainWnd->ShowWindow(m_nCmdShow);
    	this->m_pMainWnd->UpdateWindow();
    	return TRUE;
    }
    
    BEGIN_MESSAGE_MAP(CMainWindow,CFrameWnd)
    	ON_WM_PAINT()
    END_MESSAGE_MAP()
    
    //CMainWindow
    CMainWindow::CMainWindow()
    {
    	Create(NULL,_T("The Hello 程序"));
    }
    
    void CMainWindow::OnPaint()
    {
    	CPaintDC dc(this);
    	CRect rect;
    	GetClientRect(&rect);
    	dc.DrawText(_T("Hello,MFC您好!"),-1,&rect,DT_SINGLELINE | DT_CENTER | DT_VCENTER);
    }
    
    
    /************************************************************/
    
  • 相关阅读:
    【BZOJ2288】生日礼物 [贪心]
    Tinyhttpd阅读笔记
    数据结构-图-经典算法(三)
    数据结构-图-经典算法(二)
    数据结构-图-经典算法(一)
    TCP协议的滑动窗口协议以及流量控制
    2016腾讯实习电话面试总结---2016-03-10
    B树,B+树,B*树
    平衡二叉树(AVL树)
    二叉搜索树(二叉查找树,二叉排序树)
  • 原文地址:https://www.cnblogs.com/wucg/p/3330081.html
Copyright © 2011-2022 走看看