Results 1 to 6 of 6

Thread: LoadKeyboardLayout API

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    3

    Post

    I want to change the layout of my keyboard in a visual basic application. I want to change from French(Canada) to English(Canada).

    This is my code :

    Private Sub Command2_Click()
    LoadKeyboardLayout "0000409", KLF_SUBSTITUTE_OK
    End Sub

    But it don't work and I don't know why.. Does somebody could help me !?

    Thanks you,

    Jonathan Fleury


  2. #2
    Addicted Member
    Join Date
    Jul 1999
    Location
    Portland, OR.
    Posts
    226

    Post

    Hi.

    Provided that you've declared LoadKeyboardLayout function in a module.

    Private Sub Command2_Click()
    LoadKeyboardLayout "00000409", KLF_ACTIVATE
    End Sub

    Good Luck.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    3

    Post

    It didn't work and I declared my api in a module...

    I'm using Visual Basic 5 under Windows 98

    Thanks !

  4. #4
    Addicted Member
    Join Date
    Jul 1999
    Location
    Portland, OR.
    Posts
    226

    Post

    If you may.
    How did you declare it? Post your Code.


  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    3

    Post

    In a module :

    Declare Function LoadKeyboardLayout Lib "user32.dll" Alias "LoadKeyboardLayoutA" (ByVal pwszKLID As Long, Flag As Boolean) As Long

  6. #6
    Addicted Member
    Join Date
    Jul 1999
    Location
    Portland, OR.
    Posts
    226

    Post

    Hi.

    In your module paste the following:
    Code:
    Public Const HKL_PREV = 0
    Public Const HKL_NEXT = 1
    
    Public Const KLF_ACTIVATE = &H1
    Public Const KLF_SUBSTITUTE_OK = &H2
    Public Const KLF_UNLOADPREVIOUS = &H4
    Public Const KLF_REORDER = &H8
    
    ''' Size of KeyboardLayoutName (number of characters), including nul terminator
    Public Const KL_NAMELENGTH = 9
    
    Declare Function LoadKeyboardLayout Lib "user32" Alias "LoadKeyboardLayoutA" (ByVal pwszKLID As String, ByVal flags As Long) As Long
    Good Luck.


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