Hi all,
I am trying to get the selected item text from a tree view control.
For that i am using this code. Please take a look. In this code, i am using console write function so that i am able to know that the user clicks in an item. This code works perfectly at the first click. But when i click on an item second time, it will work twice, That means, console write will work twice. Same result is at the third and fourth click also.
Func TreeView_WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $wParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview
$hWndTreeview = $tv1
If Not IsHWnd($tv1) Then $hWndTreeview = GUICtrlGetHandle($tv1)
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndTreeview
Switch $iCode
Case $TVN_SELCHANGINGW
ConsoleWrite("Clicked" & @CRLF)
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY