Here is a demo. Move the slider and release the left mouse button when the cursor is in front of the thumb. In that case you should not hear the sound play, in which case A_GuiEvent4 failed. On my system (i7-4790k) it only triggers if I don't move the slider too fast. You may need to change the loop length to suit your system. It's a problem for me because I need to execute some lines ONLY on mouse release, otherwise it's too much overhead to have that subroutine executing tens of times (and sometimes it has actually crashed AHK).
Code: Select all
#Persistent
#SingleInstance Force
SetBatchLines , -1
DllCall("QueryPerformanceCounter", "Int64*", CounterBefore)
Sleep 1000
DllCall("QueryPerformanceCounter", "Int64*", CounterAfter)
1ms := (CounterAfter - CounterBefore) / 1000
Gui, New
Gui, Add, Slider, ToolTip AltSubmit x10 y10 w720 Range-35-35 vSlider1 gSlider1
Gui, Add, Text, vText w250 x300 yp+50
Gui, Show, w740 h100 Center, Slider Test
Slider1:
DllCall("QueryPerformanceCounter", "Int64*", CounterBefore)
counter := 0
loop 1500000
{
counter += 1
}
DllCall("QueryPerformanceCounter", "Int64*", CounterAfter)
GuiControl ,, Text, % "Subroutine duration: " . Round(((CounterAfter - CounterBefore) / 1ms)) . "ms"
If (A_GuiEvent = 4)
Soundplay , *64
return