Reputation: 541
I want to open in my main window 3rd party application, for example office, or adobe reader.
Something like this. This example is in windows forms. Embeded application
But I can use only pure c++ with winapi. Is it possible? What can I use for it. Can you give me some example?
Thanks
Upvotes: 0
Views: 189
Reputation: 2672
You can do this by identifying the window's handle (HWND) of the application to be embedded. Then you can re-parent that window into the host window using SetParent function of the Window API. Window handles are 32-bits so this will work even between 32/64 bits processes.
Attention should be payed however to dispatch events correctly from the host application to the embedded window (for example when re-sizing or hiding the host, the embedded window should be re-sized or hidden as well). And also position the embedded window inside the host.
Here is an example of this approach
This may work fine with notepad, but more complex applications can manifest strange behavior when re-parented to another process window, but you can experiment.
Upvotes: 1