2011-04-13 58 views

回答

0

我的樹視圖其實是一個「森林」(一堆樹)。我發現我可以遍歷根:

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) { 
    ... 
} 
相關問題