Results 1 to 8 of 8

Thread: Positioning of OnScreen KeyBoard

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    155

    Positioning of OnScreen KeyBoard

    Hi ;
    I tried to Postion the On_Screen Keyboard (Window Accessories) using VB without Success.

    Can someone show me the way???


    Thanks

  2. #2
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Positioning of OnScreen KeyBoard

    VB Code:
    1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    2. Private Declare Function MoveWindow Lib "user32" (ByVal Hwnd As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    3. Private Type RECT
    4.     Left As Long
    5.     Top As Long
    6.     Right As Long
    7.     Bottom As Long
    8. End Type
    9. Private Type POINTAPI
    10.     X As Long
    11.     Y As Long
    12. End Type
    13. Private Declare Function GetWindowRect Lib "user32" (ByVal Hwnd As Long, lpRect As RECT) As Long
    14.  
    15. Private Sub Form_Load()
    16. Dim RC As RECT, OSKHwnd As Long
    17.  
    18.     OSKHwnd = FindWindow(vbNullString, "On-Screen Keyboard")
    19.     GetWindowRect OSKHwnd, RC
    20.     MoveWindow OSKHwnd, 0, 0, RC.Right - RC.Left, RC.Bottom - RC.Top, 1
    21. End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    155

    Re: Positioning of OnScreen KeyBoard

    Thanks For Your Help. I can Position now. But If I place a shell("OSK,VBnormalFocus) right before OSKhwnd=findwindow, and some how I drag the Keyboard to some where and reopen it, the Keyboard seems to be at the changed position and then back to the preset value. It is particularly obvious if I place a button to dynamically change the keyboard Positon. you have any idea why? Thanks again

  4. #4
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Positioning of OnScreen KeyBoard

    Sorry i'm not sure i understand what you mean. Do you want the Keyboard to always be in one place only while your program is running?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    155

    Re: Positioning of OnScreen KeyBoard

    Sorry for the confusion:

    If the Keyboard had been Displayed, If I drag the keyboard to another Position say Location A, It seems that the Keyboard will memorized Location A. When I closed the Keyboard, And Re open it (say with Button), It will start from Location A then Goto the Preset Location from the program.

    Thanks

  6. #6
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Positioning of OnScreen KeyBoard

    I tried to open the OSK hidden then change its position, then finally show it again, but it seems that the OSK doesn't allow me to run it hidden and so will always show itself. So i don't think there is a way to show it in the preset position that way.

    The only other way that i can think of is to edit the registry and change its startup position, so when it loads, it will start in the preset position.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    155

    Re: Positioning of OnScreen KeyBoard

    Registry?Do you know the path?

  8. #8
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Positioning of OnScreen KeyBoard

    I've searched my registry but i can't seem to find it. Sorry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width