Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 8-Dec-13 9:58am
v2

1 solution

There is no "conversion". You rather should learn .NET and write if from scratch, borrowing and translating only the code not related to UI. The concepts have something in common but very different. .NET provides much more powerful UI development capabilities abstracted from the native platforms (which can still be used via P/Invoke, not recommended unless it's absolutely needed), while MFC is relatively thin layer over raw Windows API, so it's much lower level, totally tied with a single platform with non-OOP interface.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900