Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _ hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _ lParam As Any) As Long
Private Const TVM_GETNEXTITEM = &H110A Private Const TVGN_CARET = 9
Function GetTreeViewNodeHandle(ByVal TV As TreeView, Node As Node) As Long Dim selNode As Node Set selNode = TV.SelectedItem Set TV.SelectedItem = Node GetTreeViewNodeHandle = SendMessage(TV.hWnd, TVM_GETNEXTITEM, TVGN_CARET, _ ByVal 0&) Set TV.SelectedItem = selNode End Function |