I am working on a WPF/C# application for completing forms. I am trying to find a way to determine if the TapTip keyboard (TabTip.exe / metro-like keyboard for windows 8 desktop) is minimized / not visible in windows 8.
I have been able to detect if the osk keyboard (osk.exe / windows accessibility on-screen keyboard) is minimized, but the same process does not seem to work with the TabTip keyboard.
To detect if the keyboard is minimized I:
1. Find the keyboard's process
2. Get the MainWindowHandle
3. Use the showCmd property of the WINDOWPLACEMENT (found using MainWindowHandle)
4. Use showCmd value to determine if window is minimized
The problems I have run into are:
- the TabTip process has a MainWindowHandle of 0 (so I can't use it to find the WINDOWPLACEMENT information)
- the values for WINDOWPLACEMENT.showCmd are the same when TabTip is open and minimized
In order to find the handle of the TabTip window I used ENUMWINDOWS to get all the window handles, GETWINDOWTHREADPROCESSID to get the process ids, then compared the ids to the TabTip process id.
Any help with this would be appreciated. Also this is my first post. I think I did this right, but if not please let me know how to fix it.
If I remember correctly, the window class name for
TabTip.exe
isIPTip_Main_Window
. You can use the Win32 APIFindWindow
to get theHWND
ofTabTip.exe
. This is more reliable than using the window title and recommended as some windows can have empty titles (or the title can change).Your current approach using
EnumWindows
could be flawed due to a single process having many windows (or windows with child windows). You can use a tool likeSpy++
to find the actual window you want and the respective class name.You can still use
GetWindowHandleThreadProcessId
to retrieve theprocessID
at that point, though I do not think you will need it for simple window state monitoring.Also, try using Win32 APIs instead of whatever is built into the CLR. For example
GetWindowPlacement
.Note from MSDN:
Hope that helps, if you still need further assistance leave a comment and I'll make an edit once I get back to my Win8 machine.
I tried a few different methods before finding one which works. Using
IsWindowVisible()
didn't work and I also didn't have any joy withGetWindowPlacement()
orGetIconic()
. In the end I usedGetWindowLong()
and checked for theWS_VISIBLE
coming back. A quick console app to demonstrate is as follows:This totally works!