1

I have an application with a username and password entry on touchscreen. When the on screen keyboard appears, it appears on top of the username entry. I would like it to appear a little lower on the screen. I am almost certain that I am using the correct handle, as Spy++ tells me it's the same, and when I use a close method with the same handle it works.

Here is the code which I have tried.

[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, ExactSpelling = true, SetLastError = true)]
internal static extern void MoveWindow(IntPtr hwnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);

[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

public void OpenAndMoveTabTipWindow()
{         
    // Call on screen keyboard
    System.Diagnostics.Process.Start(@"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe");

    IntPtr id;           
    id = FindWindow("IPTIP_Main_Window", "");

    MoveWindow(id, 0, 0, 100, 100, true);
}
kennyzx
  • 12,845
  • 6
  • 39
  • 83
  • Would [this interface](http://msdn.microsoft.com/en-us/library/windows/desktop/ms695563%28v=vs.85%29.aspx) help (assuming you can invoke COM interface methods from C#)? – andlabs Dec 10 '14 at 14:45
  • Thank you but, I am using WPF. I think this applies to windows store does it not? –  Dec 10 '14 at 15:05
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). – John Saunders Dec 10 '14 at 15:10
  • Wait, you're writing a Windows Store app? [Because the code you have now won't work to begin with; `FindWindow()` is listed as "desktop apps only"...](http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499%28v=vs.85%29.aspx) And taking a closer look, I don't know if the Tablet PC API will work here too (MSDN doesn't seem to say)... Is there no WPF API for interfacing with (the) on-screen keyboard(s)? – andlabs Dec 10 '14 at 15:19
  • You can refer to [this question](http://stackoverflow.com/questions/1770670/how-do-i-control-the-text-input-panel-programmatically-tabtip-exe-in-windows-v), it provides a solution to your issue, which is docking the window to the other side of the screen or make it floating (draggable). But I guess TabTip has imposed some restrictions on `MoveWindow` since it is a full size keyboard- it cannot display correctly in a size of 100x100. – kennyzx Dec 10 '14 at 15:36

0 Answers0