cu0x

_WinAPI_GetKeyboardLayout returns 0 by Windows Server 2012

2 posts in this topic

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)

 

 

 

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
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

  • Similar Content

    • edwick
      By edwick
      Does anyone here have experience using AutoIt on virtual Windows machines like in VirtualBox or Cloudify? I'm trying to write some AutoIt scripts but even the basic WinZip tutorial .au3 does not work on either a Windows 10 VM in VirtualBox (running over MacOS X) or on a Windows Server 2012 VM running on Cloudify/OpenStack. The Run("winzip90.exe") command works and launches the installer, but nothing I've tried to click the "Setup" button does anything. I've tried using "Send()" as documented in the tutorial, "ControlClick()", and even "MouseClick()" with coordinates but none of them seem to be clicking the button and making the install proceed.
      I've found some posts here that refer to using AutoIt on AWS and VMware, so I suspect there might just be something I'd need to configure somewhere, though I can't figure out what it would be.