Jump to content

How do I send a Button Click with GUICtrlSendMsg() to myself?


Recommended Posts

  • 1 year later...

@Fingo  Not precisely true.  It could be appropriate under certain circumstances to send a message to self...

#include <GUIConstants.au3>

Global Const $MK_LBUTTON = 1


Func Example()
  Local $hGUI = GUICreate("Example", 300, 200)
  Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25)

  Sleep(1000)  ; leave some time to see the GUI

  GUICtrlSendMsg($idButton_Close, $WM_LBUTTONDOWN, $MK_LBUTTON, 0x00030003)
  GUICtrlSendMsg($idButton_Close, $WM_LBUTTONUP, $MK_LBUTTON, 0x00030003)

  While 1
    Switch GUIGetMsg()
      Case $GUI_EVENT_CLOSE, $idButton_Close
        ConsoleWrite("Closing GUI" & @CRLF)
EndFunc   ;==>Example


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

  • Recently Browsing   0 members

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