As pointed out by the developer of AutoIt, the "mouse move" event is the second-most called message, so you may want to pre-filter it too, after the "0" message.
#include <GUIConstantsEx.au3>
While 1
Switch GUIGetMsg()
Case 0, $GUI_EVENT_MOUSEMOVE
ContinueLoop
Case $control1
Func1()
Case $control2
Func2()
EndSwitch
WEnd
Trying to watch several message sources, namely GUIGetMsg()
and TrayGetMsg()
, I encountered difficulties because of the ContinueLoop
.
But the solution is in fact simple, don't shortcut the loop, just break the switch (remember breaks are implicit in AutoIt):
#include <GUIConstantsEx.au3>
While 1
Switch GUIGetMsg()
Case 0, $GUI_EVENT_MOUSEMOVE
; break
Case $control1
Func1()
Case $control2
Func2()
EndSwitch
Switch TrayGetMsg()
Case 0, $GUI_EVENT_MOUSEMOVE
; break
Case $control3
Func3()
Case $control4
Func4()
EndSwitch
WEnd
(I just checked, TrayGetMsg()
does send $GUI_EVENT_MOUSEMOVE
messages too)