Jump to content

_WinAPI_GetKeyboardLayout returns 0 by Windows Server 2012


cu0x
 Share

Recommended Posts

I´m trying to get the Keyboard language and get als return "0" wenn I do it under Windows Server 2012, I executed also in Windows 7 x64 and works fine :S

Any suggestion? Appreciate it!

Here my code:

#include <WinAPISys.au3>    

    Run("cmd.exe", "", @SW_HIDE)
    Local $hWnd = WinWait("[CLASS:ConsoleWindowClass]")
    Local $bNewKey = "0" & StringRight(_WinAPI_GetKeyboardLayout($hWnd), 3)
    
    MsgBox(0,"Keyboard Language", $bNewKey)

 

 

 

 

Link to comment
Share on other sites

I´m trying to get the Keyboard language and get als return "0" wenn I do it under Windows Server 2012, I executed also in Windows 7 x64 and works fine :S

Any suggestion? Appreciate it!

Here my code:

#include <WinAPISys.au3>    

    Run("cmd.exe", "", @SW_HIDE)
    Local $hWnd = WinWait("[CLASS:ConsoleWindowClass]")
    Local $bNewKey = "0" & StringRight(_WinAPI_GetKeyboardLayout($hWnd), 3)
    
    MsgBox(0,"Keyboard Language", $bNewKey)

 

So I found 1 minute later how to do it :)

#include <WinAPISys.au3>    


    Local $hWnd = _WinAPI_GetDesktopWindow()
    Local $bNewKey = "0" & StringRight(_WinAPI_GetKeyboardLayout($hWnd), 3)
    
    MsgBox(0,"Keyboard Language", $bNewKey)

 

 

 

 

 

 

Edited by cu0x
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...