问题
When we press start menu on windows 8.1 it show up all new start menu with apps in form of tiles. This menu shows up on entire screen. Is there a way to detect if this menu is open in c++. Is there a winAPI to do so in 8.1 SDK.
Thanks in advance.
回答1:
Call CoCreateInstance(CLSID_AppVisibility,...) to get the object that implements IAppVisibility then call IAppVisibility::IsLauncherVisible to see if the start menu is visible.
This is demonstrated in the Start screen visibility sample
回答2:
I am unsure about whether there exists a dedicated WinAPI call, but what you could do is run EnumWindows with the start menu open and closed to determine the window handle and then examine its class and other parameters - that way if you know how to identify it you can always perform the same logic in your program - enumerate the windows, find the handle of the start menu, check if it is visible.
回答3:
you have to use hook, a special hook for shell https://msdn.microsoft.com/en-us/library/windows/desktop/ms644991%28v=vs.85%29.aspx, then on HSHELL_WINDOWACTIVATED
event check for the ClassName of the returned GetForegroundWindow()
来源:https://stackoverflow.com/questions/33105881/how-to-detect-windows8-1-start-menu