Win32控制台程序如何获取MFC库支持
2011-12-13 08:44
399 查看
原文:http://www.codeproject.com/Tips/297862/Convert-Win32-Console-Application-to-MFC
Assuming you have Console based application created with MFC support (i.e., you have not chosen MFC support while using New Project Wizard).
In this Tip/Trick, I am not going into detailed steps of how to create a new project and all. I assume you know all these and face a real life problem of adding MFC support to existing applications.
Follow these simple steps and your application will have MFC support.
Here I am using project name as MyApp and
IDE is Visual Studio 2008.
Open your project.
In Project Menus --> Select MyApp Properties(MyApp -> name of my project)
In Configuration Properties -> General -> Use of MFC, select Use MFC in a Shared DLL option.
Add the following line in your stdafx.h file.
Collapse | Copy
Code
Now your application has MFC support, now you can use any MFC Class, Function or Structure.
Happy programming!
Assuming you have Console based application created with MFC support (i.e., you have not chosen MFC support while using New Project Wizard).
In this Tip/Trick, I am not going into detailed steps of how to create a new project and all. I assume you know all these and face a real life problem of adding MFC support to existing applications.
Follow these simple steps and your application will have MFC support.
Here I am using project name as MyApp and
IDE is Visual Studio 2008.
Open your project.
In Project Menus --> Select MyApp Properties(MyApp -> name of my project)
In Configuration Properties -> General -> Use of MFC, select Use MFC in a Shared DLL option.
Add the following line in your stdafx.h file.
Collapse | Copy
Code
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit #ifndef VC_EXTRALEAN #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif #include <afx.h> #include <afxwin.h> // MFC core and standard components #include <afxext.h> // MFC extensions #ifndef _AFX_NO_OLE_SUPPORT #include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls #endif #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // MFC support for Windows Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT #include <iostream>
Now your application has MFC support, now you can use any MFC Class, Function or Structure.
Happy programming!
相关文章推荐
- 如何在Win32 Console Application (Win32控制台)程序中使用MFC
- GUI程序如何使用控制台输出调试信息[zz][MFC调用win32窗口显示调试信息,使用AllocConsole 函数 ]
- 在MFC,Win32程序中向控制台(Console)窗口输出调试信息
- 如何在Win32窗口程序中发命令打开一个控制台,往里面打印(printf())输出一些数据
- MFC程序中如何获取控件在客户区的坐标?
- 在MFC,Win32程序中向控制台(Console)窗口输出调试信息
- VS2010如何在控制台应用程序中添加对MFC库的支持
- 关于win32程序如何使用mfcdll的问题.
- Visual 中控制台程序如何使用MFC类库
- 同时支持控制台和MFC窗口程序的APP
- Windows客户端开发--使用WMI获取显卡详细信息(win32控制台程序)
- 关于如何用od反汇编win32 控制台程序
- 【Visual C++ 2010】如何快速将Win32程序改为控制台程序
- win32和MFC下如何使用控制台窗口
- windows下的vs2017新建win32控制台应用程序项目如何调出程序向导选项?
- 控制台下NMAKE编译WIN32/VC/MFC程序步骤
- Windows客户端开发--使用WMI获取显卡详细信息(win32控制台程序)
- win32和MFC下如何使用控制台窗口
- VC的Win32控制台程序中使用MFC库文件
- 在MFC,Win32程序中向控制台(Console)窗口输出调试信息