如何将MFC应用程序项目添加到Visual C 2008中的Win32应用程序项目
How to add MFC application project to Win32 application project in Visual C++ 2008
我已经花了大部分时间试图弄清楚为什么会发生这个错误,但它继续使我感到惊讶。
我在Visual C 中创建了一个控制台应用程序,并创建了一个MFC应用程序。......
我添加了AFX标头文件,设置配置设置。
我想知道从winmain()还是int main()中的起点是从哪里开始?有例子吗?给我一些链接来知道。解决方案预先感谢您。
创建基于MFC对话框的应用程序。项目 - 属性 - 配置工作人员 - 链接器 - 高级 - 入口点,设置wwinmaincrtstartup(假设该项目是Unicode)。链接器 - 系统 - 选择控制台。构建应用程序。现在它打开控制台窗口和对话框。
添加一些逻辑。例如,在我的应用程序类CPP文件中,我添加了以下内容:
#include "stdafx.h"
#include "testmfc.h"
#include "testmfcDlg.h"
#include <iostream> // add
#include <string> // add
using namespace std; // add
...
BOOL CtestmfcApp::InitInstance()
{
...
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
// ****** add this
string s;
cout << "Start application?" << endl;
cin >> s;
if ( s == "y" )
{
CtestmfcDlg dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
}
// ******
// Delete the shell manager created above.
if (pShellManager != NULL)
{
delete pShellManager;
}
return FALSE;
}
现在运行应用程序。如果您在控制台窗口中回答" Y",则显示对话框。否则,申请立即退出。根据此样本实现自己的逻辑。
相关文章:
- VS2017 中缺少 Win32 控制台应用程序.如何创建C++空项目?
- 如何将此项目更改为 OpenCV 实时人脸检测应用程序?
- 在 C++/CLI/C# 项目中启用"Native Code Debugging"导致应用程序崩溃
- 将 Dr. Memory 与 Visual Studio 项目配合使用时出错:缺少应用程序所需的库
- 无法编译QT创建快速应用程序项目
- 从 WebAPI 项目运行静态类时出现 StackOverflow 异常 - 从控制台应用程序运行时工作正常
- 将函数从控制台应用程序移动到共享库项目似乎会带来不相关的编译错误
- 如何将解决方案中的项目从应用程序更改为静态库
- 如何在 silverlight 应用程序中引用 C++/CLI 项目
- 如何将boost.asio添加到windows通用应用程序项目中
- 如何将MFC应用程序项目添加到Visual C 2008中的Win32应用程序项目
- 一个解决方案,两个项目:如何从 Windows 应用程序调用控制台项目?C++
- 在Visual Studio 2010中将控制台项目转换/移植到无形应用程序
- 如何在应用程序项目中使用android原生代码
- 用C++创建一个写作应用程序(我的第一个项目)(学习C++)
- 如何从终端为本机应用程序创建android项目
- 使用Visual Studio c++的Windows窗体应用程序,该应用程序链接到CUDA项目
- 引用Windows应用商店应用程序项目中的C++WinRT组件
- visual 无法在控制台应用程序项目中包含头文件C++
- C/ c++应用程序项目(NetBeans)中的多个源文件