I have an app here I made for a client, but sometimes he doesn't know if an order has arrived because he plays World Of Warcraft with the volume max'd out. But he said he wants my little notification window to appear on top of his game if a new order arrives.
So, I was thinking I could just use BringToFront();
which seems to work when full-screen apps are Maximized. But, I have noticed that while playing V8 Supercars in full screen, BringToFront();
doesn't bring the notification window on top of the game, so I figure that some games have another way of making sure they remain on top of everything else.
How can I make sure that whenever I need my form to be seen, it will always show up on top of anything else?
form.TopMost = true;
form.ShowDialog();
form.BringToFront();
Should work with all applications, full-screen exclusive games included (tested on all my games, so far, it works).
You could try setting the notification form's TopMost
property to true
...or make it modal by calling .ShowDialog
instead of .Show
.
I struggled with the same topic, especially when a "link" to a custom protocol was clicked in Outlook. (The App catched it, but always in the background...)
Even though a lot of solutions worked while debugging, for the "Live-Deployment" only the following chain of calls seems to achieve what was desired:
(Invoked, cause handling of links happens from a thread)
this.Invoke(new Action(() => {
this.Activate();
//...do stuff
this.TopMost = true;
this.BringToFront();
this.TopMost = false;
}));
Works about every time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With