Click here to Skip to main content
16,013,548 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi All,

I am facing one problem.I can open form of one exe in another application using below code.
C#
private void Form2_Load(object sender, EventArgs e)
       {
               Process objLVProcess ;
               objLVProcess = new Process();


               String strLVExePath  = "../../WindowsFormsApplication1.exe";
               ProcessStartInfo objLVProInfo = new ProcessStartInfo(strLVExePath);


               objLVProInfo.RedirectStandardOutput = true;
               objLVProInfo.RedirectStandardInput = true;
               objLVProInfo.RedirectStandardError = true;
               objLVProInfo.CreateNoWindow = true;
               objLVProInfo.WindowStyle = ProcessWindowStyle.Normal;
               objLVProInfo.UseShellExecute = false;
               objLVProcess.StartInfo = objLVProInfo;
               objLVProcess.Start();
       }

But problem is that the form should be within the parent form and shouldn't be moved outside of parent form and currently these things are not happened.How can Do this?

Thanks,
Abhay
Posted
Updated 17-Apr-12 18:54pm
v4
Comments
Sergey Alexandrovich Kryukov 18-Apr-12 0:57am    
I know how to do it, but do you want a good friendly informal advice? Don't to bad things. Stay out of trouble. This is a huge abuse of technology. Processes are designed for strong isolation from each other. If you need to reuse code, reference one assembly by another one, is it as a library, but in the same process. I just don't want to give you an answer and encourage you to do something which will give you nothing but troubles...
--SA
avay 18-Apr-12 1:09am    
You know one thing, employees in a software company can't do the thing in their way because it always a client requirement .I don't mind if you don't give me the code.If you don't want to give me the code then pls don't put the your answer here as your advice.

Thanks,
Abhay
Sergey Alexandrovich Kryukov 20-Apr-12 16:03pm    
No. I think you just not clear about what part of decision is made where.
Your "If you don't want to give me the code... don't put" is extremely rude. I am trying to help you, and you are trying to demand certain way. If I gave you some code the way you want, I would make harm, because it won't help you.

The further answer depends on the following two things:
1) Do you have the source code of WindowsFormsApplication1.exe?
2) What is "WindowsFormsApplication1.exe"? A console application, a Forms application, WPF, etc... what?
--SA
avay 24-May-12 5:57am    
Thanks & Sorry for that but people are here to solve their issues.I solved myself so many days ago with little additional code which is very very easy enough.

1 solution

Hi Is that what you meant?
Hosting EXE Applications in a WinForm project[^]

I hope it's helps.
Roman
 
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