0
在Win32::GuiTest documentation我只能找到兩個函數來處理樹控件,GetTreeViewSelPath
和SelTreeViewItemPath
。任何人都可以推薦一種方法來檢測樹中節點的打開/關閉狀態嗎?如何使用Win32 :: GuiTest檢查樹視圖控件的擴展狀態?
在Win32::GuiTest documentation我只能找到兩個函數來處理樹控件,GetTreeViewSelPath
和SelTreeViewItemPath
。任何人都可以推薦一種方法來檢測樹中節點的打開/關閉狀態嗎?如何使用Win32 :: GuiTest檢查樹視圖控件的擴展狀態?
我的樹視圖其實是一個「森林」(一堆樹)。我發現我可以遍歷根:
my $i = 0;
my @states;
for (my $node = Win32::GuiTest::SendMessage($windows[0],
0x1100 + 10, # Get next
0, # root
0); # N/A
$node != 0;
$node = Win32::GuiTest::SendMessage($windows[0],
0x1100 + 10, # Get next
1, # Sibling
$node)) { # from current
my $state = Win32::GuiTest::SendMessage($windows[0], 0x1100 + 39,
$node, 0xff);
$states[$i] = $state;
$i++;
}
我發現常數(根,兄弟姐妹等)在http://www.xtremevbtalk.com/showthread.php?t=45515:
' messages
Public Const TV_FIRST = &H1100
Public Const TVM_GETNEXTITEM = (TV_FIRST + 10)
Public Const TVM_GETITEM = (TV_FIRST + 12)
' TVM_GETNEXTITEM wParam values
Public Enum TVGN_Flags
TVGN_ROOT = &H0
TVGN_NEXT = &H1
TVGN_PREVIOUS = &H2
TVGN_PARENT = &H3
TVGN_CHILD = &H4
TVGN_FIRSTVISIBLE = &H5
TVGN_NEXTVISIBLE = &H6
TVGN_PREVIOUSVISIBLE = &H7
TVGN_DROPHILITE = &H8
TVGN_CARET = &H9
如果我有一個正常的樹,我可能會做:
node = root
for (node = child; node != 0; node = sibling) {
...
}