Rennen.Chacham
March 6th, 2008, 02:18 PM
Hello,
-- Introduction --
I wish to "steal" a control from another process and use it in my window on my process, as if it was a part of my application.
The reason behind this is that the other process is not very stable and may crash\freeze suddently.
Hence, I have done the following:
1. After my process is fully created, I create the new processes from which I want to "steal" their windows.
2. I detect the window handle of the control I want to take over on.
3. Use SetParet() to move the other-process' control to be a child window.
Also, I'm setting the window size and location to match, and use ShowWindow on the original parent, to make the main window of the other process disappear.
When the application goes down, I kill the other process and the game is over.
-- The problem --
It is indeed made my software a lot more stable.
Whenever the other process crashes - my process is still alive.
Yet, sometimes the stolen control gets busy (i.e. responding to a button click, or due to some other freeze issue in the other process). When this occours, my process is hang as well, completely.
My desired behavior would be that the stolen control will be either grayed out or not painted, yet not to affect the main window and other controls. Maybe even change the title and add "Not responding" like windows is doing when a process hangs (and not just hangs the entire desktop).
Please help... how can I do it?
-- Things I've tried, without success --
I have tried running a thread to monitor the other process, and see if it is responding. However, the Process.Responding property in c# always consider both 2 processes as responding.
Also the other process' main gui thread is always at "waiting" mode, no matter what.
-- Introduction --
I wish to "steal" a control from another process and use it in my window on my process, as if it was a part of my application.
The reason behind this is that the other process is not very stable and may crash\freeze suddently.
Hence, I have done the following:
1. After my process is fully created, I create the new processes from which I want to "steal" their windows.
2. I detect the window handle of the control I want to take over on.
3. Use SetParet() to move the other-process' control to be a child window.
Also, I'm setting the window size and location to match, and use ShowWindow on the original parent, to make the main window of the other process disappear.
When the application goes down, I kill the other process and the game is over.
-- The problem --
It is indeed made my software a lot more stable.
Whenever the other process crashes - my process is still alive.
Yet, sometimes the stolen control gets busy (i.e. responding to a button click, or due to some other freeze issue in the other process). When this occours, my process is hang as well, completely.
My desired behavior would be that the stolen control will be either grayed out or not painted, yet not to affect the main window and other controls. Maybe even change the title and add "Not responding" like windows is doing when a process hangs (and not just hangs the entire desktop).
Please help... how can I do it?
-- Things I've tried, without success --
I have tried running a thread to monitor the other process, and see if it is responding. However, the Process.Responding property in c# always consider both 2 processes as responding.
Also the other process' main gui thread is always at "waiting" mode, no matter what.