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_
  • 相关阅读:
    样式
    样式表的类别、选择器和优先级
    随记
    框架
    表单元素
    HTLM内容容器标签和常用标签
    HTML5的意义、改变以及全局属性
    11月21日html基础
    感想 目标和展望
    C++结构体实例和类实例的初始化
  • 原文地址:https://www.cnblogs.com/nchxmoon/p/2984134.html
Copyright © 2011-2022 走看看