Click here to Skip to main content
15,881,872 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a application which can run alone.
And I want to use It as a part of a new application.
For example:
A.exe is the application which can run alone.
B.exe is a new application.

In B.exe, there is a MDI form.
I want to use A.exe run as a child form of the main form.

Can I realize it? Or,is there another way to use A.exe as a part of B.exe?
Can you give me some sample code?
I use C#.
Posted
Comments
Toli Cuturicu 10-Mar-11 12:03pm    
Do not ever again try to post a fake answer.
I deleted the fake answers with which you flooded this question!
And I mean it, really, do not do this again!
taony 10-Mar-11 12:07pm    
I am sorry.I donn't know clearly how to use this. This is my first question. I thought it as MSDN forum.
Sorry.
Toli Cuturicu 11-Mar-11 14:21pm    
Ok. I thought you were just hunting for reputation points. Sorry for being so harsh.
Anyway, it's a good thing you learned how to use the system, isn't it?

This thread[^] has some suggestions, but as it also says they do not work for all application.
 
Share this answer
 
Comments
taony 10-Mar-11 12:19pm    
Thank you.
No. You can't do it.

You would need to recode A.exe into a DLL and use it from there.
 
Share this answer
 
Comments
taony 10-Mar-11 12:19pm    
Thank you.
The simple answer is NO you can not do it.

But if you remove the requirement of using A.exe as child form, there are few things you can do. Say A.exe does some actions or performs some processing, you could leave A.exe as is and spawn it from B.exe. This does not mean it is running as child form, rather a full fledged self contained exe. The advantage is you don't have to change any ( or at least very little in A.exe)

Where as if you insist on using it child form, then follow what OriginalGriff suggested.
 
Share this answer
 
Comments
taony 10-Mar-11 12:20pm    
Thank you.
taony 10-Mar-11 13:29pm    
Please take a view: http://www.codeproject.com/KB/miscctrl/AppControl.aspx
Hi

If A.exe also a .Net exe then you can add reference the A.exe to B.exe. The A.exe is in its own namespace.

Then set the B.exe's form's isMdiContainer property to true. Now you can open A.exe's form1 as child here

C#
private void Form1_Load(object sender, EventArgs e)
{
    Form frm = new A.Form1();// A is the namespace of A.exe and it has a form1 form.
    frm.MdiParent = this;
    frm.Show();
}
 
Share this answer
 
Comments
taony 10-Mar-11 12:33pm    
A.exe isn't a .net exe.
Thank you for your answer.
apaka 10-Mar-11 12:37pm    
You could probably use this http://www.codeproject.com/KB/miscctrl/AppControl.aspx
taony 10-Mar-11 12:39pm    
Thank you.You are smart.
There is actually a good article on CP about this:

Hosting EXE Applications in a WinForm project[^]
 
Share this answer
 
Comments
taony 10-Mar-11 12:59pm    
Yes,I am testing it now.It can work well.

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