I need to find the current top most window on Windows 8.
Using EnumWindows is pointless as it only returns the current windows in Desktop mode.
There however is a COM class IMetroMode which allows me to find if the "Start Screen" (Metro Launcher) is active or if the given Desktop is in Metro mode. IMetroMode->GetMonitorMode.
Is there any way to find out the current active Metro App in case the desktop is in Metro mode?
Related
How to enumerate and control the position and size
of child windows of ApplicationFrameHost.exe
from Powershell.... or C#
In this case the Windows of Microsoft.Notes (Sticky Notes)
(This App uses Metro/UWP GUI components like Edge, Calculator, etc.)
In this case only the open notes...
(open Microsoft.Notes Windows)
But I am curious also iif the Note/Window Position+Size
can be saved within the note
In Windows 8 Win Store apps started by default in full screen mode.
In Windows 10 Desktop Mode apps starts in windowed mode, and app title bar has additional icon, which allows to switch to full screen mode (first icon, note that it's different behavior than maximizing window, third icon).
Is there a possibility to maximize this window programatically, e.g. via WinAPI call? Alternatively, is there any option (other than switching to Tablet Mode) to start it in full screen by default?
Question is not about changing app sources, I want to switch running app to full screen as a part of automated testing process.
Yes you can try to make the app runs in full screen by:
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
And try to play and check the methods available in ApplicationView.GetForCurrentView().. You'll love it :)
Full screen metro application windows are not listed when using EnumWindows API (https://msdn.microsoft.com/en-us/library/windows/desktop/ms633497%28v=vs.85%29.aspx). Those windows are listed when in restored or maximized mode, but fails when in full screen mode. Note that all metro applications do not have a full screen mode. The application I tried was the gaming application named 3D Chess Game, and the call back function given in the EnumWindows API was not invoked for the 3D chess Game full screen window, while it was called for all other top level windows on screen.
What could be the reason for this behaviour? Is there an alternative way to enumerate through the full screen metro app windows?
Any help on this is appreciated.
Thanks in advance.
I don't know why EnumWindows not enumerate the full screen metro (UWP) apps, but if you know the window title, you can retrive its handle using FindWindow:
var hwnd = FindWindow(null, "Full screen window title");
If you don't know the title of the window or you want to enumerate all windows, regardless of their title, you have to call EnumChildWindows as explained in this answer.
On Windows 8 they've replaced the Start Menu with a Start Screen using Metro GUI.
Desktop applications can be run from this screen, but when they exit the user is left at the desktop.
Is there a Windows setting that will return to the Start Screen automatically when the application is closed, if it was launched from Metro?
Or is there an API available so that the application itself can detect whether it was launched from Metro and then switch back to it as it is shutting down?
(I want something automatic or programmatic. "Press the Windows key" is not an acceptable solution.)
Window 8 metro GUI is working like Start menu so I will change my application's setup program to put some command line options for desktop menu shortcut and pick it up from Param array.
When closing I would try sending Windows button combination (Ctrl+Esc) to windows. Actual code to do that depends on the language used to develop your app. If developed in .Net following class can be helpful
System.Windows.Forms.SendKey.Send
http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx
following library may also be useful
http://inputsimulator.codeplex.com/
When I install a virtual desktop manager on Windows 7, and I switch to a different virtual desktop, all the current windows disappear, also disappearing from the Start Menu.
I want to hide some of a particular application's windows, but not all of them, in a similar manner. How can I hide a window like this?
In particular, I need to hide a VirtualBox Seamless mode window, so I'm not sure minimizing the window will work. It does, however, disappear when using virtual desktop managers.
The same window cannot appear on multiple desktops. If you need your application window to appear on multiple desktops you need to create a separate window for each desktop. The desktop a window appears on depends on the thread that creates the window. You can change the desktop thread assignment using the SetThreadDesktop function.
The answer is simply ShowWindow(SW_HIDE) and ShowWindow(SW_SHOW). I think "Virtual Desktop Managers" just hide windows and show them as necessary when the desktops change.