Jump to content

WM_Notify doesn't give correct information


Rad
 Share

Recommended Posts

EDIT: Nevermind, I forgot a single line of code:

$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)

...Where is the delete button :)

I'm going off the _GUICtrlListView_Create() example, trying to copy some code out of it and get it to work with my current script. But it's really long and has a LOT of random variables like $tNMHDR and such. I do not know where to begin for debugging... ugh! I can't find a way to decide what element was double-clicked on.

So, I copied pieces from the help file and it works. But the data returned by WM_NOTIFY is always the same.

Here is the appropriate code for declaring my list view, although it's not generated exactly like this:

$filetree = _GUICtrlListView_Create($GUI,'',28,28,450,450)
$filetree_column = _GUICtrlListView_AddColumn($filetree, "", $width - $width * 0.1)
$file_list[$i][2] = _GUICtrlListView_AddItem($filetree, $file_list[$i][0])

And here is what I've gathered from the help file:

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
;~  Local $tBuffer
    $hWndListView = $filetree
    If Not IsHWnd($filetree) Then $hWndListView = GUICtrlGetHandle($filetree)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")

    Local $tagNMHDR, $vEvent

    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
            Case $NM_DBLCLK 
                
                
                
consoleWrite("-->hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags") & @CRLF)
                
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Edited by Rad
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...