Hosting an application inside a custom window?
-
Hey there, I have to debug an application and want to write a small tool to watch the memory changing "on demand" while working with the application and reproducing the errors. I thought about hosting the application itself in a custom window to directly include it into my programm, having all debug output windows next to it (something like a TDI interface). So far so good... I decided to hook the
CreateWindowEx
method for the program to return the HWND of one of my tab pages (the one hosting the app). It would be to easy if it would have worked! ;P I guess the problem is that the application is running in another process/thread and the window itself lays inside the memory area of my process. Now if the application tries to access the window with the handle from a different process the access fails. Is there any way to create a window inside some kind of shared memory to do this? Or am I simply missing something? Would be cool if anyone can help me with this! :) Thank you! http://www.aschratt.com -
Hey there, I have to debug an application and want to write a small tool to watch the memory changing "on demand" while working with the application and reproducing the errors. I thought about hosting the application itself in a custom window to directly include it into my programm, having all debug output windows next to it (something like a TDI interface). So far so good... I decided to hook the
CreateWindowEx
method for the program to return the HWND of one of my tab pages (the one hosting the app). It would be to easy if it would have worked! ;P I guess the problem is that the application is running in another process/thread and the window itself lays inside the memory area of my process. Now if the application tries to access the window with the handle from a different process the access fails. Is there any way to create a window inside some kind of shared memory to do this? Or am I simply missing something? Would be cool if anyone can help me with this! :) Thank you! http://www.aschratt.com -
Hey there, I have to debug an application and want to write a small tool to watch the memory changing "on demand" while working with the application and reproducing the errors. I thought about hosting the application itself in a custom window to directly include it into my programm, having all debug output windows next to it (something like a TDI interface). So far so good... I decided to hook the
CreateWindowEx
method for the program to return the HWND of one of my tab pages (the one hosting the app). It would be to easy if it would have worked! ;P I guess the problem is that the application is running in another process/thread and the window itself lays inside the memory area of my process. Now if the application tries to access the window with the handle from a different process the access fails. Is there any way to create a window inside some kind of shared memory to do this? Or am I simply missing something? Would be cool if anyone can help me with this! :) Thank you! http://www.aschratt.comJust a conceptual (and very late) idea: how about hooking the GetDC, GetWindowDC and BeginPaint (...) calls, returning some kind of memory DC with a bitmap selected into it (size equivalent to the window that would be drawn onto normally), letting the process draw its things into this memory DC, then when ReleaseDC or EndPaint (you would need to hook those too) is called, transfer the content of the DC over to your process trough a socket or named pipe or somesuch along with size and position information and then blitting it into your own window. Of course there's also the problem that this method would still leave the original application's window hanging around the desktop undrawn and you would also need to direct input (clicks, mouse move events...) back to the original application for processing which might also pose problems, but maybe this could be a starting point towards something useful...
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > //TODO: Implement signature here<