Announcement

Collapse
No announcement yet.

KeyBoardLayout question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • KeyBoardLayout question

    hi all
    i try to get the key board layout with
    PHP Code:
    TempKeyBoard "KL_NAMELENGTH","0"
    key_layout DLL.CallFunction("user32.dll""GetKeyboardLayoutNameW"TempKeyBoardDLL_RETURN_TYPE_LONGDLL_CALL_STDCALL
    now the var key_layout point to the (keyboard layout name)
    or point to the success or fail of the dll call

    any idia to get this function do its job ??

  • #2
    When using these dll functions scroll to the bottom of the page and if it gives you two choices pick the A so its GetKeyboardLayoutNameA for ANSI as Lua doesn't do Unicode thats GetKeyboardLayoutNameW.

    You need a buffer as well so you'll need the MemoryEx plugin and the code will be something like this:

    Code:
    --Load the dll
    User32Library = Library.Load("user32.dll")
    --Create a buffer
    B = MemoryEx.Allocate(9)
    --Call the function passing it the buffer address
    User32Library.GetKeyboardLayoutNameA(B)
    --If function returns > 0 then get buffer content
    t = MemoryEx.String(B,-1,MEMEX_ASCII)
    --Close buffer
    MemoryEx.Free(B)
    --Close dll if finished
    User32Library:Close_()
    --If function call was > 0 then t has the info you want
    Dialog.Message("",t)

    Comment


    • #3
      waw !!!!!
      this is magic man !!
      tons of thanks
      for this super solution

      another thank for the creator of this nice plugin

      Comment

      Working...
      X