Chris86 Posted March 6, 2014 Posted March 6, 2014 (edited) Hello I'm making a GUI that needs WM_Notify to work as I want to. Now my WM_Notify is enabling and disabling input and button in my GUI if there is enough characters in the string but I also want it to detect when the user clicks one of the rows in the ListView. Here is the working WM_Notify script im using (>Thanks to Martin is this topic) Func GUI_WM_COMMAND($hWnd, $imsg, $iwParam, $ilParam) Local $setHK = False $nNotifyCode = BitShift($iwParam, 16) $nID = BitAND($iwParam, 0x0000FFFF) $hCtrl = $ilParam If $nNotifyCode = $EN_CHANGE Then Select Case $hCtrl = GUICtrlGetHandle($InputDellOnSiteRepairID) If Stringlen(GUICtrlRead($InputDellOnSiteRepairID)) = 11 Then GUICtrlSetState($InputSak, $GUI_ENABLE) GUICtrlSetState($ButtonFindCase, $GUI_ENABLE) Else GUICtrlSetState($InputSak, $GUI_DISABLE) GUICtrlSetState($ButtonFindCase, $GUI_DISABLE) EndIf ;------------------ Case $hCtrl = GUICtrlGetHandle($InputSak) If Stringlen(GUICtrlRead($InputSak)) = 5 Then GUICtrlSetState($ButtonAdd, $GUI_ENABLE) Else GUICtrlSetState($ButtonAdd, $GUI_DISABLE) EndIf EndSelect EndIf Return $GUI_RUNDEFMSG EndFunc Is there any way i can merge my script with this? Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $ListView Select ; Case $event = $NM_CLICK ; ConsoleWrite("SingleClick" & @LF) Case $event = $NM_DBLCLK $editsqlquery = 1 ;Setup GLOBAL variables rather than calling functions this part need to exit as fast as possible EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc ;==>WM_Notify_Events >Source Edited March 6, 2014 by Chris86
FireFox Posted March 7, 2014 Posted March 7, 2014 Of course, register both events. There are "templates" in the helpfile, search for WM_COMMAND and WM_NOTIFY. Br, FireFox.
Chris86 Posted March 7, 2014 Author Posted March 7, 2014 Thanks But will it have any bad performance hit if i have two events registered?
FireFox Posted March 7, 2014 Posted March 7, 2014 Not at all if there's no blocking code inside (which is not recommended).
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