Reputation: 787
Like messengers, if the user runns some program in full screen e.g wmplayer they can change their status to away. Similary is there any way to find out in JAVA if the system is running something in full screen mode?
Upvotes: 1
Views: 1561
Reputation: 403
Use JNA (https://mvnrepository.com/artifact/net.java.dev.jna/jna)
public static boolean isAppInFullScreen()
{
WinDef.HWND foregroundWindow = User32.INSTANCE.GetForegroundWindow();
WinDef.RECT foregroundRectangle = new WinDef.RECT();
WinDef.RECT desktopWindowRectangle = new WinDef.RECT();
User32.INSTANCE.GetWindowRect( foregroundWindow, foregroundRectangle );
WinDef.HWND desktopWindow = User32.INSTANCE.GetDesktopWindow();
User32.INSTANCE.GetWindowRect( desktopWindow, desktopWindowRectangle );
return foregroundRectangle.toString().equals( desktopWindowRectangle.toString() );
}
This will return true if any application/program in windows is running in full screen mode. Even browser in F11 mode returns true with this.
Upvotes: 1
Reputation: 133
AutoIt is a powerful Windows GUI automation tool, which has lots of features for investigating & interacting with windows, among other things. I know they provide various ways of interacting with the AutoIt functionality externally, it may be worth investigating:
http://www.autoitscript.com/autoit3/index.shtml
Upvotes: 1