rasim Posted February 25, 2008 Share Posted February 25, 2008 Hi! Anyone help me withs this code. I try to use WM_MOUSEHOVER message, but unsuccessful expandcollapse popup#include <GUIConstants.au3> Global Const $WM_MOUSEHOVER = 0x02A1 Global Const $TME_HOVER = 0x1 Global Const $TME_LEAVE = 0x2 Global Const $TME_NONCLIENT = 0x10 Global Const $TME_QUERY = 0x40000000 Global Const $TME_CANCEL = 0x80000000 $hGui = GUICreate("Test GUI", 160, 50) $button1 = GUICtrlCreateButton("Button1", 10, 10, 50, 25) $button2 = GUICtrlCreateButton("Button2", 100, 10, 50, 25) $TRACKMOUSEEVENT = DllStructCreate("dword Size;dword EventFlags;hwnd hwndTrack;dword HoverTime") DllStructSetData($TRACKMOUSEEVENT, 1, 255) DllStructSetData($TRACKMOUSEEVENT, 2, $TME_HOVER) DllStructSetData($TRACKMOUSEEVENT, 3, $hGui) DllStructSetData($TRACKMOUSEEVENT, 4, 30) $MouseEvent = DllCall("user32.dll", "int", "TrackMouseEvent", "ptr", DllStructGetPtr($TRACKMOUSEEVENT)) ConsoleWrite($MouseEvent[0] & @LF) ;Always returned nul :( GUIRegisterMsg($WM_MOUSEHOVER, "WM_MOUSEHOVER") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_MOUSEHOVER($hWnd, $Msg, $wParam, $lParam) ConsoleWrite($wParam & @LF) Return $GUI_RUNDEFMSG EndFuncWhat`s wrong? Link to comment Share on other sites More sharing options...
Siao Posted February 25, 2008 Share Posted February 25, 2008 (edited) 1) TrackMouseEvent call fails, because you set incorrect Size value in TRACKMOUSEEVENT structure. If you can't add up the elements manually, use DllStructGetSize($TRACKMOUSEEVENT). 2) For it to actually work (to generate WM_MOUSEHOVER message), the mouse has to be inside GUI at the time you call TrackMouseEvent. Which also assumes the GUI is visible at the time. Edited February 25, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
rasim Posted February 26, 2008 Author Share Posted February 26, 2008 Yes! Now this works! Thank you! Siao the best! Link to comment Share on other sites More sharing options...
GaryFrost Posted February 26, 2008 Share Posted February 26, 2008 http://www.autoitscript.com/forum/index.ph...st&p=383523 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
rasim Posted February 26, 2008 Author Share Posted February 26, 2008 Oh! Thanks Gary! 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