Jump to content

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


Glyph
 Share

Recommended Posts

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

Link to comment
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.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...