4ggr35510n Posted January 9, 2011 Share Posted January 9, 2011 I believe there is none working example of WM_MOUSELEAVE notification ( I could be wrong ), using TrackMouseEvent, on this Forum. I've had some serious trouble some time to make it work. I believe someone will use it one day :] expandcollapse popupGlobal $is_tracking = False Global $iteration = 1 ; Just to recognize different ConsoleWrite's in spammed console Global $hGui = GUICreate('') Global $sTrackMouseEvent = DllStructCreate('dword;dword;hwnd;dword') ; Creating TRACKMOUSEEVENT Structure Global $sTME_size = DllStructGetSize($sTrackMouseEvent) ; getting size of structure - need for 1st argument ; Filling in: DllStructSetData($sTrackMouseEvent, 1, $sTME_size) ; Size of a structure DllStructSetData($sTrackMouseEvent, 2, 0x00000002) ; TME_LEAVE DllStructSetData($sTrackMouseEvent, 3, $hGui) ; HWND of our GUI DllStructSetData($sTrackMouseEvent, 4, 0xFFFFFFFF) ; HOVER_DEFAULT - BUT IT'S NOT USED ANYWAY, SINCE WE'RE TRACKING ONLY MOUSE_LEAVE EVENT Global $sTME_POINTER = DllStructGetPtr($sTrackMouseEvent) ; Getting the pointer to the structure, needed to TrackMouseEvent function GUIRegisterMsg(0x0200, '__wm_mousemove') GUIRegisterMsg(0x02A3, '__wm_mouseleave') ; WM_MOUSELEAVE code GUISetState() Func __wm_mouseleave($hwnd, $msg, $wParam, $lParam) $is_tracking = False ConsoleWrite('YOUR MOUSE HAS JUST LEAVED YOUR GUI WINDOW FOR THE ' & $iteration & ' TIME!' & @CRLF) $iteration += 1 EndFunc Func __wm_mousemove($hwnd, $msg, $wParam, $lParam) If Not $is_tracking Then $is_tracking = True DllCall('user32.dll', 'bool', 'TrackMouseEvent', 'ptr', $sTME_POINTER) ; We're calling the tracking function ConsoleWrite('Starting tracking...' & @CRLF) EndIF EndFunc Do Until GuiGetMsg() = -3 musicstashall 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now