I would like to integrate an existing program (ex: notepad, explorer, etc.) into a new window I want to create. The purpose would be to have 2 different programs in 1 window. Do you know if it is something possible? If it is, what kind of technology could I use? (I can use C++, C# in windows 7/Visual) Thanks.
Asked
Active
Viewed 518 times
-1
-
1I think you can already have 2 or more different programs running in one Windows... haha, so funny me... anyway check out [this](http://www.codeproject.com/Articles/23064/Window-Tabifier) and [this](http://www.codeproject.com/Articles/9123/Hosting-EXE-Applications-in-a-WinForm-project) – musefan Jun 12 '12 at 08:41
-
@musefan +1 for the second link – Spooky Jun 12 '12 at 08:43
-
your first link seems good because it can handle an explorer window, whereas the project of your second link can't. I will try to understand it (maybe difficult!) – Maelkun Jun 12 '12 at 10:25
-
possible duplicate of [How can I run another application within a panel of my C# program?](http://stackoverflow.com/questions/758494/how-can-i-run-another-application-within-a-panel-of-my-c-sharp-program) – Dan Is Fiddling By Firelight Aug 16 '14 at 20:35
-
There was a similar [question](http://stackoverflow.com/questions/758494/how-can-i-run-another-application-within-a-panel-of-my-c-sharp-program). One of the solutions was [this](http://en.wikipedia.org/wiki/Object_Linking_and_Embedding). Hope this might help you. – Ivan Crojach Karačić Jun 12 '12 at 08:38
1 Answers
0
If you wish to add an external program then I suggest you have a look at SetParent
, ShowWindow
and SetWindowLong
. The theory is to set your window (or a control within your window) to be the parent of another window/control.

Spooky
- 2,966
- 8
- 27
- 41
-
Thanks. I tried this : http://www.codeproject.com/Articles/9123/Hosting-EXE-Applications-in-a-WinForm-project It's great, it works fine with notepad, but the problem is that it doesn't work with ieplorer or explorer... – Maelkun Jun 12 '12 at 09:32
-
I am working on Windows 7 and Internet Explorer and Explorer are not handled into my GUI, they are open like a popup, in a new window. – Maelkun Jun 12 '12 at 11:28
-
Perhaps you could try starting the processes with their windows hidden and use [`EnumWindows`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms633497%28v=vs.85%29.aspx) to get the related windows, when they're created. – Spooky Jun 12 '12 at 11:46
-
I know why it doesn't work for Explorer. Actually, explorer.exe is already started, so when I start it again, it just open a new window that I can't get the process for this particular window... By using EnumWindow, I can get it, but how can I identify it among all the opened windows?? – Maelkun Jun 13 '12 at 14:05
-
I suggested `EnumWindows` so that you could find the windows owned by a certain process. But in this circumstance that wouldn't work as a new process isn't actually being made. Unfortunately I don't know of a _nice_ solution to this... but you could _try_ injecting a DLL into the process and detouring `CreateWindow`? Or perhaps you could even find all the windows owned by the (existing) process _before_ running it again, and then after you've run it again, search for the windows again and grab the new window that has been created. But this idea is flawed if the user opens explorer themselves. – Spooky Jun 13 '12 at 19:15