Jump to content

Recommended Posts

Posted

It works.

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Opt("GUIOnEventMode", 1)

    GUICreate("Parent1")
    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "SpecialEvents")


    GUISetState(@SW_SHOW)

    ; Just idle around
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>Example

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            MsgBox($MB_SYSTEMMODAL, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

            GUIDelete()
            Exit
        Case @GUI_CtrlId = $GUI_EVENT_SECONDARYDOWN
            MsgBox($MB_SYSTEMMODAL, "Secondary CLICK", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

    EndSelect
EndFunc   ;==>SpecialEvents

Saludos

Posted

Did you try any debugging and see if SpecialEvents was even getting called?

Func SpecialEvents()
    ConsoleWrite("SpecialEvents called" & @LF)
    Switch (@GUI_CtrlId)
        Case $GUI_EVENT_CLOSE
            MsgBox($MB_SYSTEMMODAL, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

            GUIDelete()
            Exit
        Case $GUI_EVENT_SECONDARYDOWN
            MsgBox($MB_SYSTEMMODAL, "Secondary CLICK", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

    EndSwitch
EndFunc   ;==>SpecialEvents

 

Posted (edited)

added $GUI_EVENT_PRIMARYDOWN:

$GUI_EVENT_CLOSE and $GUI_EVENT_PRIMARYDOWN called.

$GUI_EVENT_SECONDARYDOWN not called.

Edited by Ontosy
Posted
10 hours ago, Ontosy said:

Why not for me in Windows 10?

I tested in windows 10 x64 . It's ok.

 

Saludos

Posted

The script is same that Danyfirex:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Opt("GUIOnEventMode", 1)

    GUICreate("Parent1")
    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "SpecialEvents")


    GUISetState(@SW_SHOW)

    ; Just idle around
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>Example

Func SpecialEvents()
    ConsoleWrite("SpecialEvents called" & @LF)
    Switch (@GUI_CtrlId)
        Case $GUI_EVENT_CLOSE
            MsgBox($MB_SYSTEMMODAL, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

            GUIDelete()
            Exit
        Case $GUI_EVENT_PRIMARYDOWN
            MsgBox($MB_SYSTEMMODAL, "Secondary CLICK", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
        Case $GUI_EVENT_SECONDARYDOWN
            MsgBox($MB_SYSTEMMODAL, "Secondary CLICK", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

    EndSwitch
EndFunc   ;==>SpecialEvents

I also have same problem in other pc with Win7 x64.

Primary work secondary not.

Posted

This script also working, but you forgot to edit line 32 to display the right message.

May be some app is hooking your mouse and destroy the event? Did your secondary mousebutton work in other applications? 

Posted

I have fixed line 32.

secondary mousebutton work in other applications but i have found that it also have conflict with other application. ty.

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...