Jump to content
Sign in to follow this  

Pressing any key won't terminate script

Recommended Posts

Looking to have the script quit when either the mouse is moved or any key is pressed. The keypress doesn't seem to trigger when I create the picture control. If I comment out the GUICtrlCreatePic line, it works. If I leave it in, only the mouse move will terminate the script. I'd appreciate any insight. Thanks

#include <GUIConstants.au3>
Global Const $WM_KEYDOWN = 0x0100
Opt("RunErrorsFatal", 0)
Opt("GUIOnEventMode", 1)

$hGUI = GUICreate('test',300,200, 0, 0)
GUIRegisterMsg($WM_KEYDOWN, 'Terminate')
$pic = GUICtrlCreatePic(@WindowsDir & '\lanma256.bmp', 10, 10, 0, 0)

While 1

Func Terminate($hWnd, $msg, $wParam, $lParam)
EndFunc  ;==>Terminate

Func TermEvent()
EndFunc  ;==>TermEvent

Share this post

Link to post
Share on other sites

How about trying to disable the state of the pic so no messages are received from it.

GuiCtrlSetState($pic, $GUI_DISABLE)

Done off top of my head so do check syntax. :)

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...