I am developing dekstop app, that will be used on windows tablet(C#) and at some point want to find out if TabTip.exe on-screen keyboard is visible or not. The problem is, behavior is different when I test it on a computer that runs Win 8.1 and a tablet with Win 8.1. I will copy small code parts from my test application.
What I do is I user user32.dll to find this out
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(String sClassName, String sAppName);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = true)]
public static extern bool IsWindowVisible(IntPtr hWnd);
I have a button in my example app, where, when I press button it prints out if TabTip is visible or nor
public void IsVisible(object sender, RoutedEventArgs e)
{
IntPtr KeyboardWnd = FindWindow("IPTip_Main_Window", null);
Console.WriteLine("Keyboard is visible :" + IsWindowVisible(KeyboardWnd));
}
The thing is... When I start this on a computer that runs Windows 8.1 I get correct value from IsWindowVisible.
On a tablet... I ALWAYS get true. Anyone has any clue why?
UPDATE
I tried using suggested GetWindowRect. The thing is the same as with isWindowVisible. On a tblet, no matter the keyboard is seen or not GetWindowRect return TRUE. Values Top, Bottom, Left, Right aleays has value. On regular computer GetWindowRect return FALSE, when TabTip is not visible. Can anyone explain how I can detect if TabTip is visible(Is seen in current window) on a TABLET?