monoscout999 Posted July 6, 2011 Share Posted July 6, 2011 (edited) Hi forum, searching an easy way to get a hover status from a control i learn to use the window message WM_NOTIFY to do the work, but this message only gets two types of notification from the iCode-12-1249 ; this when the mouse pass over a control and when it leavessupposedly there are 19 notifications codes according MDSNWhat i`m doing wrong?#include <WindowsConstants.au3> #include <winapiex.au3> global $i = 0 Global $check = False $hGui = GUICreate("Test hover", -1, -1) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") $button1 = GUICtrlCreateButton("No Hover", 10, 10, 100, 50) $button2 = GUICtrlCreateButton("No Hover", 10, 70, 100, 50) GUISetState() Do Until GUIGetMsg() = -3 Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ; WN_NOTIFY - http://msdn.microsoft.com/en-us/library/bb775583%28VS.85%29.aspx Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) ; NMHDR Structure - http://msdn.microsoft.com/en-us/library/bb775514%28v=VS.85%29.aspx Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Local $idFrom = DllStructGetData($tNMHDR, "idFrom") Local $iCode = DllStructGetData($tNMHDR, "Code") ;~ If $iCode <> -12 Then ConsoleWrite($iCode & @CRLF) $i +=1 ConsoleWrite("The notification code is "&$iCode &" and the number of times that the message was processed is "&$i &@CRLF) ; This for check propurses Switch $iCode Case -1249 ; $NM_HOVER - http://msdn.microsoft.com/en-us/library/bb775536%28VS.85%29.aspx $check = Not $check If $check Then GUICtrlSetData($idFrom, "Hover") Else GUICtrlSetData($idFrom, "No Hover") EndIf EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_NOTIFY Edited July 7, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
jaberwacky Posted July 7, 2011 Share Posted July 7, 2011 The script seems to work fine. What notifications were you looking for specifically? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
wolf9228 Posted July 7, 2011 Share Posted July 7, 2011 Hi forum, searching an easy way to get a hover status from a control i learn to use the window message WM_NOTIFY to do the work, but this message only gets two types of notification from the iCode -12 -1249 ; this when the mouse pass over a control and when it leaves supposedly there are 19 notifications codes according MDSN What i`m doing wrong? #include <WindowsConstants.au3> #include <winapiex.au3> global $i = 0 Global $check = False $hGui = GUICreate("Test hover", -1, -1) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") $button1 = GUICtrlCreateButton("No Hover", 10, 10, 100, 50) $button2 = GUICtrlCreateButton("No Hover", 10, 70, 100, 50) GUISetState() Do Until GUIGetMsg() = -3 Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ; WN_NOTIFY - http://msdn.microsoft.com/en-us/library/bb775583%28VS.85%29.aspx Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) ; NMHDR Structure - http://msdn.microsoft.com/en-us/library/bb775514%28v=VS.85%29.aspx Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Local $idFrom = DllStructGetData($tNMHDR, "idFrom") Local $iCode = DllStructGetData($tNMHDR, "Code") ;~ If $iCode <> -12 Then ConsoleWrite($iCode & @CRLF) $i +=1 ConsoleWrite("The notification code is "&$iCode &" and the number of times that the message was processed is "&$i &@CRLF) ; This for check propurses Switch $iCode Case -1249 ; $NM_HOVER - http://msdn.microsoft.com/en-us/library/bb775536%28VS.85%29.aspx $check = Not $check If $check Then GUICtrlSetData($idFrom, "Hover") Else GUICtrlSetData($idFrom, "No Hover") EndIf EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_NOTIFY BCN_HOTITEMCHANGE Notification Code http://msdn.microsoft.com/en-us/library/bb775984%28v=VS.85%29.aspx http://msdn.microsoft.com/en-us/library/bb775959%28v=VS.85%29.aspx expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <WindowsConstants.au3> global $i = 0 Global $check = False $hGui = GUICreate("Test hover", -1, -1) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") $button1 = GUICtrlCreateButton("No Hover", 10, 10, 100, 50) $button2 = GUICtrlCreateButton("No Hover", 10, 70, 100, 50) GUISetState() Do Until GUIGetMsg() = -3 Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ; WN_NOTIFY - http://msdn.microsoft.com/en-us/library/bb775583%28VS.85%29.aspx Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) ; NMHDR Structure - http://msdn.microsoft.com/en-us/library/bb775514%28v=VS.85%29.aspx Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Local $idFrom = DllStructGetData($tNMHDR, "idFrom") Local $iCode = DllStructGetData($tNMHDR, "Code") Local $BCN_HOTITEMCHANGE = -1249 , $HICF_ENTERING = 0x10 , $HICF_LEAVING = 0x20 , $HICF_MOUSE = 0x1 ;~ If $iCode <> -12 Then ConsoleWrite($iCode & @CRLF) $i +=1 ConsoleWrite("The notification code is "&$iCode &" and the number of times that the message was processed is "&$i &@CRLF) ; This for check propurses Switch $iCode Case $BCN_HOTITEMCHANGE ; $NM_HOVER - http://msdn.microsoft.com/en-us/library/bb775536%28VS.85%29.aspx $tagNMBCHOTITEM = $tagNMHDR & ";DWORD dwFlags" $NMBCHOTITEM = DllStructCreate($tagNMBCHOTITEM, $ilParam) $dwFlags = DllStructGetData($NMBCHOTITEM, "dwFlags") Select Case BitAND($dwFlags,$HICF_ENTERING) GUICtrlSetData($idFrom, "Hover") Case BitAND($dwFlags,$HICF_LEAVING) GUICtrlSetData($idFrom, "No Hover") EndSelect EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_NOTIFY Button Hover Button_ButtonHover / Static_ButtonHover Second Static_ButtonHover /Fast response GuiSetBackGround / Image And Sound صرح السماء كان هنا 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