Sign in to follow this  
Followers 0
Glyph

[Resolved] Possible to use WM_Notify on 2x listviews?

3 posts in this topic

#1 ·  Posted (edited)

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $hWndListView2, $tInfo, $listview, $banview
;~  Local $tBuffer
    $hWndListView = $listview;Add the listview's handle here
    If Not IsHWnd($listview) Then $hWndListView = GUICtrlGetHandle($listview)
    
    $hWndListView2 = $banview;Add the listview's handle here
    If Not IsHWnd($banview) Then $hWndListView2 = GUICtrlGetHandle($banview)
    
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    ;msgbox(0,"Index of "&_GUICtrlListView_GetItemText($listview, DllStructGetData($tInfo, "Index")),"Ping/TracerT/CMD terminal/commandlist/help")
                    ListView_RClick(_GUICtrlListView_GetItemText($listview, DllStructGetData($tInfo, "Index")))
                    ;Return 1 ; not to allow the default processing
                    Return 0 ; allow the default processing
                    ; No return value
                    
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    ClipPut(SocketToIP($ConnectedSocket[DllStructGetData($tInfo, "Index")][0]))
                    
            EndSwitch
            
        Case $hWndListView2;not working
            Switch $iCode
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    ClipPut("sadsadg")
            EndSwitch
            
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

I don't see why this won't work, any ideas?

Edited by Glyph

tolle indicium

Share this post


Link to post
Share on other sites



Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $hWndListView2, $tInfo, $listview, $banview
;~  Local $tBuffer
    $hWndListView = $listview;Add the listview's handle here
    If Not IsHWnd($listview) Then $hWndListView = GUICtrlGetHandle($listview)
    
    $hWndListView2 = $banview;Add the listview's handle here
    If Not IsHWnd($banview) Then $hWndListView2 = GUICtrlGetHandle($banview)
    
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    ;msgbox(0,"Index of "&_GUICtrlListView_GetItemText($listview, DllStructGetData($tInfo, "Index")),"Ping/TracerT/CMD terminal/commandlist/help")
                    ListView_RClick(_GUICtrlListView_GetItemText($listview, DllStructGetData($tInfo, "Index")))
                    ;Return 1 ; not to allow the default processing
                    Return 0 ; allow the default processing
                    ; No return value
                    
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    ClipPut(SocketToIP($ConnectedSocket[DllStructGetData($tInfo, "Index")][0]))
                    
            EndSwitch
            
        Case $hWndListView2;not working
            Switch $iCode
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    ClipPut("sadsadg")
            EndSwitch
            
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

I don't see why this won't work, any ideas?

I think you should remove

, $listview, $banview

from the local declarations in WM_NOTIFY!


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hah, what was I thinking...

It works! thank you very much, martin!

Edited by Glyph

tolle indicium

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  
Followers 0