点击节点的例子:
__________________
procedure ClickItem(hTree: THandle; hItem: HTREEITEM);
var
aRect: TRect;
begin
TreeView_GetItemRect(hTree, hItem, aRect, True);
SendMessage(hTree, WM_LBUTTONDOWN, 0,
(aRect.Left+aRect.Right) div 2 + (aRect.Top+ aRect.Bottom)*$10000 div 2);
SendMessage(hTree, WM_LBUTTONUP, 0,
(aRect.Left+aRect.Right) div 2 + (aRect.Top+ aRect.Bottom)*$10000 div 2);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
hTreeView: THandle;
Item: TTVItem;
S: string;
begin
hTreeView := $0002056A; // 你自己得到,我是用spy++
ClickItem(hTreeView, TreeView_GetSelection(hTreeView));
end;