• Advertisement
Sign in to follow this  

Including Win32 application to C# application

This topic is 3324 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, right now I am making the C# program which need to call previously made Win32 application in C++. However, this Win32 application use WinMain function, so how should I modify the WinMain of this Win32 application so that I can call WinMain any time when I need to refer it?

Share this post


Link to post
Share on other sites
Advertisement
Have a look at the System::Diagnostics::Process::Start function, especially the variant that takes two string parameters (one for the application filename, one for the parameters to the program). This will basically run the program for you.

However, if you need to get information back from the program you're running, things get a lot more complex.

Share this post


Link to post
Share on other sites
How about just obtaining the HINSTANCE?
I have tried Process.getCurrentProcess().Handle
but compiler said I need to convert it to HINSTANCE __* type

Share this post


Link to post
Share on other sites
In C#
Never mind. I solved it already.
I just used this statement:

Marshal.GetHINSTANCE(myWin32ManagedClass.GetType().Module);

I pass the return value to my C++ application as void*
and convert it into HINSTANCE afterward

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement