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);
    }
    
    
    /************************************************************/
    
  • 相关阅读:
    mysql8.0.x中datasource信息
    IDEA关联mysql失败Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezon'
    SpringSecurity配置文件
    druid监控
    Redis安装教程
    一个简单的springboot+mybatis-plus+thymeleaf的学生管理系统
    RestFul风格
    Vue利用v-for渲染时表单信息出不来
    springboot项目Invalid bound statement (not found): com.xxxx.dao.xxxDAO.xxx解决方法
    JSON
  • 原文地址:https://www.cnblogs.com/wucg/p/3330081.html
Copyright © 2011-2022 走看看