zoukankan      html  css  js  c++  java
  • How to support MFC features in Win32 application?

        Most of time, we will write some common code for MFC and Win32 applications, such as convert operations(char, string, CString, int... convertion). So the code should support MFC and Win32 features. In this article, I will give you an example about how to use MFC features in Win32 application.

        First, we have to create an common header file, named StdW32.h, which contains the MFC header files.

        Then, we have to include this header filel in all the *.h or *.cpp files.

        Now I attach the StdW32.h file code as below:

     1 // StdW32.h file for supporting MFC features in Win32 Application.
     2 // You can add some common header files here.
     3 // Make sure include this file in *.h or *.cpp files.
     4 
     5 #ifndef STDW32_H_
     6 #define STDW32_H_
     7 
     8 // Define windows version
     9 #ifndef WINVER                // Specifies that the minimum required platform is Windows Vista.  
    10 #define WINVER 0x0500        // Win2k  
    11 #endif   
    12 
    13 #ifndef _WIN32_WINNT        // Specifies that the minimum required platform is Windows Vista.  
    14 #define _WIN32_WINNT 0x0500 // Win2k  
    15 #endif
    16 
    17 // Support MFC features in Win32 application.
    18 // Setting: Project Properties->Configuration Properties->General->Use of MFC->Use MFC in a Shared DLL.
    19 #define VC_EXTRALEAN        // Exclude rarely-used stuff from Windows headers
    20 #include <afxwin.h>         // MFC core and standard components
    21 #include <afxext.h>         // MFC extensions
    22 #include <afxdisp.h>        // MFC Automation classes
    23 #include <afxdtctl.h>        // MFC support for Internet Explorer 4 Common Controls
    24 #ifndef _AFX_NO_AFXCMN_SUPPORT
    25 #include <afxcmn.h>            // MFC support for Windows Common Controls
    26 #endif // _AFX_NO_AFXCMN_SUPPORT
    27 
    28 
    29 // Add common files here...
    30 #include <iostream>
    31 #include <string>
    32 #include <vector>
    33 
    34 using namespace std;
    35 
    36 #endif // STDW32_H_
  • 相关阅读:
    Echarts柱状图,颜色随机改变
    输入地名查询出经纬度
    简单的JS数组所有重复元素抽出到一个新数组
    zTree 树形中的搜索定位节点
    vue js 中简单的搜索功能
    百度地图,多边形覆盖物区域,加标签
    pyspider 介绍
    网站的免责声明应当如何撰写才能保护自己的权益
    sftp 设置默认权限
    【聚类算法】谱聚类(Spectral Clustering)
  • 原文地址:https://www.cnblogs.com/nchxmoon/p/2984134.html
Copyright © 2011-2022 走看看