Hello, I want to be able to open a GUI application using CreateProcess in a main process and have the GUI display in a window I create from within the main process. Does anyone know how to achive this? Thanks!
views:
32answers:
2No you can't do this.
Something that might work... You could start the process though, and then using the window handle apply a series of changes to the window to take off the frame. Then you could move it to the position of some other placement control in your window and when you have move/resize events you also resize this child window.
If you are in control of both applications then yes.
This is how screen savers display in the screen saver control panel - the control panel passed the dialogs window on the command line, and the .scr file - which is just a simple exe - creates its window as a child using the given hwnd as its parent.
Capturing a previously written top level window and forcing it to exist within your own frame is however not well supported.
Again, it is something you can easilly try: I wrote a test app that created a empty frame window, did a FindWindow for copies of Notepad, and reparented the notepad window to be a child of my frame.
So it does work: in this simple scenario at least, but there is no guarantee: more complex applications that modify their own frame styles might very well break, additionally having a child window and parent window on different threads introduces the possibility of deadlocks.