Func _GUICtrlTreeView_GetItemHandle($hWnd, $hItem = 0)
If $hItem = 0 Then $hItem = 0x00000000
If IsHWnd($hWnd) Then
If $hItem = 0x00000000 Then $hItem = _SendMessage($hWnd, $TVM_GETNEXTITEM, $TVGN_ROOT, 0, 0, "wparam", "lparam", "handle");如果第二参数为0,返回第一项目ID的句柄,没毛病 .但不为0,就直接不处理了.
Else
If $hItem = 0x00000000 Then
$hItem = Ptr(GUICtrlSendMsg($hWnd, $TVM_GETNEXTITEM, $TVGN_ROOT, 0))
Else
Local $hTempItem = GUICtrlGetHandle($hItem)
If $hTempItem <> 0x00000000 Then $hItem = $hTempItem
EndIf
EndIf
Return $hItem
EndFunc ;==>_GUICtrlTreeView_GetItemHandle
当传入的hwnd参数是句柄,第二个参数是项目控件ID.根据上面的逻辑,项目ID不经处理就返回了.与预期的结果不一样.
不如直接用GUICtrlGetHandle($hItem),不太明白....各位有什么看法? |