Hi, i want to start a process called: notepad.exe wich is a software that windows give you. How do i start that process in a mdi container ?
process.start("notepad.exe"); in mdi container :S

Maybe this way?:

System.Diagnostics.Process myprocess = System.Diagnostics.Process.Start("notepad.exe");

Or:

Process process = new Process();
     process.StartInfo.FileName = @"notepad.exe";
     process.EnableRaisingEvents = true;
     process.Start();

Will it work ? :S

This code is not opening notepad in the mdi container

It is generally not possible to host one application in another; which I think you are trying to do.
If you are trying to write a MDI text editor then you will have to do some of the work.
You can add a TextBox or RichTextBox control to a child form in your MDI application and then add other controls to manipulate the selected text to change font and typeface etc.
I am sure there are examples out there on how to do this.

Are you shore it is not posible ?

Each process is a totally separate entity in the Windows OS.
It is possible to have communication between processes, but it is not possible to encapsulate one process inside another to the extent that one appears to be a child window in the other.

Although I do not have sand or sea I am as sure as I can be.
(However, I am always prepared to be shown otherwise in this ever changing world of coding):)

Each process is a totally separate entity in the Windows OS.
It is possible to have communication between processes, but it is not possible to encapsulate one process inside another to the extent that one appears to be a child window in the other.

Although I do not have sand or sea I am as sure as I can be.
(However, I am always prepared to be shown otherwise in this ever changing world of coding):)

You can do this now with .net but you have to load another .net assembly.

I can build two programs, reference one in the other and use say, the window of one as a control in another. It's pretty cool actually, you can do it with anything that has .net bindings =)
Of course if you build Managed C++ bindings, you can link those to a standard C++ application, creating a proxy for your C++ control\application that you can host in your WPF .net application =)

Unfortunately I don't think you can do this with notepad. As far as I'm aware there is no API you can gain access to.

Also, take Google Chrome as an example of the same thing in C++. the executable nacl64.exe is a host for the process chrome.exe, which even has its own task manager. =)

I can build two programs, reference one in the other and use say, the window of one as a control in another.

When you reference the other program in .net you are in fact using the executable (.exe) as a library (.dll). The other program is not running in a separate process. The forms and other controls are created and run by your process which is why you have control over them.

When you reference the other program in .net you are in fact using the executable (.exe) as a library (.dll). The other program is not running in a separate process. The forms and other controls are created and run by your process which is why you have control over them.

I guess I misunderstood you on that point, my apologies. However, I was correct regarding Google Chrome.

Each tab is a separate Chrome.exe process through which the window (nacl64.exe) has 2-way interaction. I'm not sure how it's done as I've already spent far too long trailing through the Chrome source code I never want to see it again :P

Edit:
Actually, a way of doing it is forming in my head..yes..

If you get the Window handle of the application you want to host, you can load that in as a frame using the window handle, so now you have a control which *is* a window, that you now have as a sub control (window) in your application. You can pass messages to and from the application I guess using the windows message system...

Each tab is a separate Chrome.exe process through which the window (nacl64.exe) has 2-way interaction.

I did not know that. But as I said in earlier post, "I am always prepared to be shown otherwise in this ever changing world of coding".:)

If you get the Window handle of the application you want to host, you can load that in as a frame using the window handle, so now you have a control which *is* a window, that you now have as a sub control (window) in your application. You can pass messages to and from the application I guess using the windows message system

Yes, that might be possible to some extent, but is not possible using .net alone and will require extensive knowledge of the Windows APIs.
This is perhaps getting beyond what the OP is trying to do.

I did not know that. But as I said in earlier post, "I am always prepared to be shown otherwise in this ever changing world of coding".:)

Yes, that might be possible to some extent, but is not possible using .net alone and will require extensive knowledge of the Windows APIs.
This is perhaps getting beyond what the OP is trying to do.

Of course, I agree. I was treating this as a thought exercise :) Sorry for derailing ^^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.