Seroko Posted November 22, 2009 Share Posted November 22, 2009 I've been using DllCall user32.dll ~ to send keypresses (I found an example in an old script and modified it to my needs) and this works fine, but it had no way of just sending keydown, I tried modifying it but nothing worked. Anyone care to help me out here? tl;dr Need to send keydown / keyup separate to a minimized window using window handle. Link to comment Share on other sites More sharing options...
lsakizada Posted November 22, 2009 Share Posted November 22, 2009 I've been using DllCall user32.dll ~ to send keypresses (I found an example in an old script and modified it to my needs) and this works fine, but it had no way of just sending keydown, I tried modifying it but nothing worked. Anyone care to help me out here? tl;dr Need to send keydown / keyup separate to a minimized window using window handle. Is this help you? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("MyTest", 407, 177, 193, 115) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### HotKeySet("^d", "_Down") HotKeySet("^u", "_Up") $hWindow = WinGetHandle("MyTest") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _Down() WinSetState($hWindow, "", @SW_MINIMIZE) EndFunc Func _Up() WinSetState($hWindow, "", @SW_RESTORE) EndFunc Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
KaFu Posted November 22, 2009 Share Posted November 22, 2009 Take a look at the ControlSend() function. An empty controlID should send the keystroke to the window. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now