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_
  • 相关阅读:
    HA: Chakravyuh Vulnhub Walkthrough
    HA Rudra: Vulnhub Walkthrough
    关于Fastjson 1.2.24 反序列化导致任意命令执行漏洞
    关于MySQL注入漏洞到获取webshell
    Windows宏病毒利用
    常规高危端口
    HA Joker Vulnhub Walkthrough
    面试题:对Vue的响应式数据/双向数据绑定原理的理解
    面试题: 对MVVN的理解
    面试题:localStorage、sessionStorage、Cookie的区别详解
  • 原文地址:https://www.cnblogs.com/nchxmoon/p/2984134.html
Copyright © 2011-2022 走看看