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_
  • 相关阅读:
    存储过程拆分字符窜
    jquery学习
    Sql常用语法
    存储过程分页
    asp.net 定时执行程序
    C# 多线程并发处理数据库数据,发送信号等待处理完统一插入.(转)
    (转)CAS 单点登录安装笔记4
    C# 自动退出当前程序,然后再启动
    给自己的Web文件夹增加一个图片或其它文件认证
    Setting NTFS Permissions with C#
  • 原文地址:https://www.cnblogs.com/nchxmoon/p/2984134.html
Copyright © 2011-2022 走看看