Jump to content
Sign in to follow this  
Chris86

Need help with WM_Notify in Listview and Input

Recommended Posts

Chris86

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 by Chris86

Share this post


Link to post
Share on other sites
FireFox

Of course, register both events.

There are "templates" in the helpfile, search for WM_COMMAND and WM_NOTIFY.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Chris86

Thanks :) But will it have any bad performance hit if i have two events registered?

Share this post


Link to post
Share on other sites
FireFox

Not at all if there's no blocking code inside (which is not recommended).


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×