本文介绍了将MFC代码转换为Windows窗体应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我有一个MFC项目,应该转换为CLR项目,但保留旧设施。

我打开MFC项目在vs2010和解决erorrs,我的解决方案资源管理器有两个项目,第一个项目是MFC(主系统),第二个是C ++ / CLI(我在解决方案MFC中创建一个Window窗体),我想同时使用MFC和CLR。在MFC和CLR之间的通信桥是一个问题,如何解决?

这里的解决方案很简单:不要在同一个应用程序中混合使用.net表单和MFC吗?



将MFC代码转换为Windows窗体应用程序

我有一个MFC程序的大量代码,我将在Windows窗体应用程序中进行转换。什么是转换此代码的最简单方法,以便在启用/ clr的情况下编译并找到基本类,例如CObject,CString,CFile和模板?如何将类,函数和属性转换为托管代码。

我在我的本机中有对话框(或者更糟糕的是,SDI / MDI视图),如何理解,图书馆在我的cli项目中使用了什么?如何演示我在C ++ / CLI(Windows窗体)中使用库MFC。??如何在CLI项目中使用等价的MFC代码?



例如,等同于以下函数在CLI项目中使用MFC?



浮动结果;

InvokeHelper(0x1,DISPATCH_PROPERTYGET,VT_R4,(void *)&result,NULL) ;



DoDataExchange(CDataExchange * pDX)



GetDlgItem(IDC_SKIL_POP_STEP2) - > EnableWindow(FALSE) ;



CModifiedAntMinerApp * pApp =(CModifiedAntMinerApp *)AfxGetApp();



OnInitDialog()



我问了同样的问题,但还没有回复。

谢谢,machin11

Hi all

I have a MFC project ,should convert to CLR project ,but with keep old facilities .
I open MFC project in vs2010 and solve erorrs,my solution explorer have two project, the first project is a MFC(Main System) and the second is a C++/CLI(I create a Window forms in solution MFC),I want to use both MFC and CLR.The comuunication bridge bewteen MFC and CLR is a probelm,how solve??
The solution here is simple: don't mix .net forms and MFC in the same application.how do??

Converting MFC code to Windows Form App
I have a large of code for an MFC program that I would convert in a windows form appllication. What is the easiest way to "convert" this code so that it compiles with /clr enabled and finds the basic classes, e.g. CObject, CString, CFile and the templates?how convert the classes,the functions and propertys over to managed code.
I have dialogs (or worse, SDI/MDI views) in my native ,how understand that, what librarys use in my cli project ? how demonstrate i use library MFC in C++/CLI (Windows Forms).??How do I equvalent MFC code in CLI project ?

For example,what is equivalent the following functions MFC in CLI project ?

float result;
InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_R4, (void*)&result, NULL);

DoDataExchange(CDataExchange* pDX)

GetDlgItem(IDC_SKIL_POP_STEP2)->EnableWindow(FALSE);

CModifiedAntMinerApp* pApp=(CModifiedAntMinerApp*) AfxGetApp();

OnInitDialog()

I've asked this same question ,but have no reszponse yet.
Thanks,machin11

推荐答案


这篇关于将MFC代码转换为Windows窗体应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 02:23