It sits in the background hidden, and when you middle-click your mouse, it pops up allowing quick access to apps/files/folders.
The problem is, that it still works when in fullscreen apps, like games and movies, so i want to stop this.
So far, i have:
//if right button has been click, show the menu
if (e.Button.Equals(MouseButtons.Middle))
{
//rect for the window size
System.Drawing.Rectangle rect;
//get the dimensions of the active window
GetWindowRect(GetForegroundWindow(), out rect);
//if window is fullscreen, dont show popup
if (rect.Height == Screen.PrimaryScreen.Bounds.Height && rect.Width == Screen.PrimaryScreen.Bounds.Width)
{
//make sure it isnt the desktop window
if (!GetForegroundWindow().Equals(FindWindow("progman", null)))
{
Console.WriteLine("cant show");
return;
}
}
this.Top = e.Y - (this.Height / 2);
this.Left = e.X - (this.Width / 2);
this.Show();
}
The above code works fine, except when the taskbar is the foreground window, it wont let the menu popup. The little "progman" bit is to check if the desktop is the foreground window, and if so, allow the popup. (desktop is considered fullscreen by that code, but i want to allow the popup)
Question
Namheul
Im working on a cool little app.
It sits in the background hidden, and when you middle-click your mouse, it pops up allowing quick access to apps/files/folders.
The problem is, that it still works when in fullscreen apps, like games and movies, so i want to stop this.
So far, i have:
The above code works fine, except when the taskbar is the foreground window, it wont let the menu popup. The little "progman" bit is to check if the desktop is the foreground window, and if so, allow the popup. (desktop is considered fullscreen by that code, but i want to allow the popup)
Any help is appreciated.
Link to comment
https://www.neowin.net/forum/topic/473950-c-detecting-full-screen/Share on other sites
4 answers to this question
Recommended Posts