Reputation: 57
I want to create WPF app and open other program on it. For the example notepad or some player on it. It is something like virtual desktop, but only for opening other apps on it. Is this posible with .NET? How can I detect other program (attached program)? How to define and attach to the wpf window? Is it WPF better than Win. Forms for this? Or may be other technology like Qt?
Upvotes: 0
Views: 128
Reputation: 644
Three steps:
Get the process of the application you want to nest in your WPF Window using the Process class.
Get the Handle of your WPF Window using the WindowInteropHelper class.
Call the Win32 function SetParent to pass the MainWindowHandle property of your Process and the Handle property of your WPF Window.
You'll need to shell out to user32.dll...
Upvotes: 1
Reputation: 12811
This sort of thing is often called "swallowing a window" and is possible on some window managers like XTerm. However, I don't believe it's possible on Windows without crafting an entirely new window manager, which is a gargantuan task.
Of course, some applications expose their GUIs through embedding technologies like ActiveX or OLE -- that's how Excel documents can be embedded in Word documents, for example. However, the application must be specifically designed to support this, and the vast majority do not.
Upvotes: 1