Jump to content
Sign in to follow this  
Seroko

How do I only send keydown to a minimized window?

Recommended Posts

Seroko

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.

Share this post


Link to post
Share on other sites
lsakizada

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)!

Share this post


Link to post
Share on other sites
KaFu

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
Sign in to follow this  

×