• 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);
    }
    
    
    /************************************************************/
    
  • 相关阅读:
    《剑指Offer》二维数组中的查找
    白话计算机入门书籍--《穿越计算机的迷雾》有感
    Mysql Cluster7.5.6在 windows10 部署安装
    Mysql Cluster7.5.6 windows10 部署安装
    lll
    线程控制
    动态链接库相关知识
    二分查找及其变种简单易懂的模版
    白话 STL next_permutation 原理
    Maven本地上有包还去网上找包
  • 原文地址:https://www.cnblogs.com/wucg/p/3330081.html
Copyright © 2020-2023  润新知