Jump to content

_WinAPI_GetKeyboardLayout Doesn't Work On Command Line


Adele
 Share

Recommended Posts

@Adele - my code did not launch the command line window.  It assumes the command line window is already open.

Try this instead:

Func _WinAPI_GetKeyboardLayout2($hWnd)
Local $hDLL = DllOpen("user32.dll")
Local $aRet = DllCall('user32.dll', 'DWORD', 'GetWindowThreadProcessId', 'hwnd', $hWnd, 'ptr', 0)
$aRet = DllCall('user32.dll', 'handle', 'GetKeyboardLayout', 'DWORD', $aRet[0])
DllClose($hDLL)
Return $aRet[0]
EndFunc   ;==>_WinAPI_GetKeyboardLayout
run("cmd.exe")
sleep(1000)
$parentPID=run("conhost.exe")
$key=_WinAPI_GetKeyboardLayout2($parentPID)
MsgBox(0,"",$key)

 

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...