jesobreira

au3 get key name text

Sep 25th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <GUIConstantsEx.au3>
  2. #include <WinAPISys.au3>
  3. #include <WindowsConstants.au3>
  4.  
  5. GUICreate('',200,300)
  6. GUIRegisterMsg($WM_KEYDOWN, 'WM_KEYDOWN')
  7. GUISetState(@SW_SHOW)
  8. $file = "keytouch" ;fichier de stockage
  9. $hFileOpen = FileOpen ($file,1); création ou ouverture du fichier pour écriture
  10.  
  11. Do
  12. Until GUIGetMsg() = $GUI_EVENT_CLOSE
  13.  
  14. #cs
  15. Func WM_KEYDOWN($hWnd, $iMsg, $wParam, $lParam)
  16. #forceref $hWnd, $iMsg, $wParam
  17. MsgBox(0,"info",$hWnd&","&$iMsg&","&$wParam&","&$lParam)
  18. FileWrite($hFileOpen,_WinAPI_GetKeyNameText($lParam))
  19.  
  20. EndFunc ;==>WM_KEYDOWN
  21. #ce
  22.  
  23. Func WM_KEYDOWN($hWnd, $iMsg, $wParam, $lParam)
  24. #forceref $hWnd, $iMsg, $wParam
  25. MSGBOX(0,'',$lParam)
  26. ConsoleWrite(_WinAPI_GetKeyNameText($lParam) & @CRLF)
  27. Return $GUI_RUNDEFMSG
  28. EndFunc ;==>WM_KEYDOWN
Add Comment
Please, Sign In to add comment