简体   繁体   English

控制台MFC应用程序

[英]Console MFC application

I have library that I would like to test. 我有要测试的库。 This library was done using MFC. 该库是使用MFC完成的。 I decided that library is using MFC because these lines in library header file: 我决定该库正在使用MFC,因为库头文件中的这些行:

#ifndef __AFXWIN_H__
    #error include 'stdafx.h' before including this file for PCH
#endif

I suppose that if I have MFC dll then I must use MFC caller. 我想如果我有MFC dll,则必须使用MFC调用程序。 Correct me if I'm wrong. 如果我错了纠正我。

I'm not familiar with MFC and I don't need to have these nice windows that gives MFC. 我对MFC不熟悉,也不需要这些具有MFC的漂亮窗口。 This form application that gives wizard looks horrible and it is not easy for me to find how to make button and bind procedure to it. 这个提供向导的表单应用程序看起来很恐怖,而且我很难找到如何制作按钮并将程序绑定到它的方法。

I just need to call one function in library. 我只需要在库中调用一个函数。 Is it possible to create console MFC application for simplicity reason? 是否可以出于简单原因创建控制台MFC应用程序?

Is it possible to create console MFC application for simplicity reason? 是否可以出于简单原因创建控制台MFC应用程序?

sure, under Visual Studio 2005 (should be doable on next versions too): 当然,在Visual Studio 2005下(也应该在下一版本中可行):

File -> New Project -> Win32 Console Application -> click Next -> check MFC checkbox -> click finish 文件->新建项目-> Win32控制台应用程序->单击下一步->选中MFC复选框->单击完成

You can also in project properties -> General -> select Use of MFC: "Use MFC in a Static Library", this will make .exe file larger, but you wont have problems running this exe on different windows versions. 您还可以在项目属性->常规->选择MFC的使用:“在静态库中使用MFC”,这将使.exe文件变大,但是在不同Windows版本上运行此exe时不会出现问题。

Yes using this: 是的,使用这个:

 file->New Project->Win32 Console Application->check checkbox empty project->finish

In solution explorer in source: 在源代码中的解决方案资源管理器中:

control->Rightclick(mouse)->Add->NewItem->Select c++ file->Name(program Name)->Add

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM