views:

54

answers:

3

Hi

I'm working on an legacy C++ application that runs on rugged business mobile devices made by Intermec. I need to add some functionality and would like to build it using WinForms. The idea is that users would click a button in the old app which would launch a WinForms screen. Then they do some stuff, click OK and are returned to the C++ app.

The question is, can I somehow "embed" the Winforms app inside the C++ app so that I can open a Winform as a modal dialog and pass information between the 2 applications.

Thanks very much for helping.

Cheers

Mark

A: 

Yes, you can do that by using CCW ( COM Callable Wrapper) read more here :- http://www.codeproject.com/KB/atl/ComWarpperForDotNet.aspx

thatsalok
Thanks I'll check it out :)
Mark Evans
This will not work. You cannot create managed COM components in the CF.
ctacke
A: 

There is MFC and WinForms Integration Demo for VS2005. Hope it helps

Andrew Florko
Cool - thanks. I will investigate. The first question is whether this stuff is supported under Windows Mobile.
Mark Evans
It's not supported in the CF, so don't spend too many cycles looking.
ctacke
+2  A: 

First let's be clear that the compact framework is not the full framework and therefore a lot of things that will work on the desktop are not going to work for you.

You really only have one option, though there are a lot of different ways to use the one option. Since teh Compact Framework does not support EE Hosting (i.e. loading the CLR up in a native application) your only option for running managed code is to write and execute a managed application. Period.

Now, as I said, there are options on how you go about this. For example you could launch the application when you launch the MFC application and simply have it running without a Form, then use some form of IPC (point to point queues would probably make the most sense, but a memory-mapped file might also be useful) and then have the applications "talk" top one another. So your C++ app could send a message that says "show Form A" and when Form A closes, the managed application could send back data.

ctacke
Thanks VERY much ctacke! I didn't get a chance to check out the other suggestions but I suspected that this was the case. You've saved me a lot of time :)
Mark Evans