zoukankan      html  css  js  c++  java
  • VS2015-Win32-DLL工程使用MFC

    项目原理使用Win32的DLL工程,不能动,需要重新创建一个,所以记录下怎么在Win32的DLL工程中,使用代码添加MFC支持

    1. 修改stdafx.h 代码

     1 #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS    // 某些 CString 构造函数将为显式的
     2 
     3 #include <afxwin.h>         // MFC 核心组件和标准组件
     4 #include <afxext.h>         // MFC 扩展
     5 
     6 #ifndef _AFX_NO_OLE_SUPPORT
     7 #include <afxole.h>         // MFC OLE 类
     8 #include <afxodlgs.h>       // MFC OLE 对话框类
     9 #include <afxdisp.h>        // MFC 自动化类
    10 #endif // _AFX_NO_OLE_SUPPORT
    11 
    12 #ifndef _AFX_NO_DB_SUPPORT
    13 #include <afxdb.h>            // MFC ODBC 数据库类
    14 #endif // _AFX_NO_DB_SUPPORT
    15 
    16 #ifndef _AFX_NO_DAO_SUPPORT
    17 #include <afxdao.h>            // MFC DAO 数据库类
    18 #endif // _AFX_NO_DAO_SUPPORT
    19 
    20 #include <afxdtctl.h>        // MFC 对 Internet Explorer 4 公共控件的支持
    21 #ifndef _AFX_NO_AFXCMN_SUPPORT
    22 #include <afxcmn.h>            // MFC 对 Windows 公共控件的支持
    23 #endif // _AFX_NO_AFXCMN_SUPPORT

    2.  工程代码中添加

    #ifdef _X86_
       extern "C" { int _afxForceUSRDLL; }
    #else
       extern "C" { int __afxForceUSRDLL; }
    #endif

    3. 修改工程属性

     工程-属性-常规-MFC使用,选择“在静态库中使用MFC

     工程-属性-C/C++-代码生成-运行库-  选择MT或者MTD (根据release或者debug确定)

     工程-属性-链接器-输入-忽略特定默认库-    afxcwd.lib libcmtd.lib msvcrtd.lib

    最后可以编译使用MFC了

  • 相关阅读:
    vue 基础 模板
    常见的JS语言错误总汇
    面向对象两大编程思想
    15条你可能不知道的JS高效技巧
    django简介
    ping连通性
    IP地址解释
    web网页请求以及网络联网的一些过程
    HTTP和HTTPS协议
    TCP和UDP
  • 原文地址:https://www.cnblogs.com/nightnine/p/12126465.html
Copyright © 2011-2022 走看看