How do i set this window to topmost?
How do i set my window above all other? I need a bad but noticeable msg box that closes on its own. Msg is a dummy form which is empty. All i want is its title. The problems with the code is the window isnt created 0,0 (its just whereever windows feels like putting it). The width is correct but i notice if i click firefox or another app window my app doesnt pop up. I know it is being shown bc i can see it in the taskbar at the bottom for a brief second. So the bugs so far
- Doesnt go topmost if i click another app
- Isnt 0,0
How do 开发者_开发知识库i fix this?
{
var msg = new Msg();
msg.Text = (has ? "*" : "+") + args[0];
msg.TopMost = true;
msg.Width = 2000;
msg.Top = 0;
msg.Left = 0;
msg.Show();
System.Threading.Thread.Sleep(1000);
msg.Close();
}
Sounds like TopMost
doesn't always do it; here's an answer to a similar question showing how to hook into Win32 for the call: Form top most?
Update: just read the rest of the answer; it might only fail running in Debug mode within Visual Studio (where your app is actually executed with vshost.exe, rather than running independently).
精彩评论