Hello to everyone.
I'm looking for a solution to the following problem and i hope someone have any good tips for me:
I have inherited a legacy application, written in C with WinAPI, that draws a 2d animation inside a window on the screen. Now I have to develop (in C#) another application that simply draws some winforms with several buttons that have to be ALWAYS in front of the legacy window, i.e. if a user click on the window of the legacy application, my winforms have to remain foreground. I would avoid to modify the legacy application, and I would act only on the new application written in C#. The "topmost" option is only the very last chance.
Thanks in advance for each contribution!
VulpesPosted Aug 20, 2014, 6:33 AM
All we need to do is to handle the Process_Exited event and call: this.Close() from the handler.
Here's the revised code:
// need to marshal back to UI thread as eventhandler called on a separate thread
// rest of code
}
Alessandro RanieriPosted Aug 20, 2014, 4:59 AM
VulpesPosted Aug 19, 2014, 2:29 PM
This will ensure that the managed form is never shown behind the legacy window.
Normally, it would also ensure that when the legacy window is minimized or closed, then the managed form would be minimized or closed as well. However, when the legacy window was closed the managed form remained open when I tried the following code and I haven't been able to find a workaround for that so far:
// ....
// rest of code
}
R JPosted Aug 19, 2014, 12:34 PM