Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Enumerate a Win32 Treeview

by slloyd (Hermit)
on Jul 25, 2005 at 20:58 UTC ( #477964=perlquestion: print w/ replies, xml ) Need Help??
slloyd has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know how to enumerate a Win32 Treeview?

Comment on Enumerate a Win32 Treeview
Re: Enumerate a Win32 Treeview
by GrandFather (Cardinal) on Jul 25, 2005 at 21:12 UTC

    What module are you using to manage the Treeview? What is the API that the module presents (is it raw Win32 API?


    Perl is Huffman encoded by design.
      The treeview is a SysTreeView32 class. I am using Win32::GuiTest and Win32::API for the calls not supported in Win32::GuiTest. My Win32 programmers reference does not mention any way to enumerate the treeview. I was hoping to find some Win32 API that I could call using the Win32::API module. I have tried GetWindowText and SendMessageA but to no avail. Ultimately I would like to write a sub that returned a hash of the treeview structure.
      ############### sub getWindowText{ my $hwnd = shift || return; $GetWindowText ||= new Win32::API("user32", "GetWindowText", ['N', + 'P', 'N'], 'N') || return; my $title = " " x 1024; my $titleLen = 1024; my $result = $GetWindowText->Call($hwnd, $title, $titleLen); if($result){return substr($title, 0, $result);} #if no result send a WM_GetText message to the window $WmSendMessage ||= new Win32::API("user32", "SendMessageA", [N, N, + N, P],'N') || return; my $WM_GETTEXT=13; my $text = " " x 2048; my $textLen = 2048; my $result = $WmSendMessage->Call($hwnd,$WM_GETTEXT, $textLen, $te +xt); if($result){return substr($text, 0, $result);} }
Re: Enumerate a Win32 Treeview
by BrowserUk (Pope) on Jul 25, 2005 at 21:54 UTC

    This should help. It sounds like TVM_GETNEXTITEM with the various flags are what you need.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
      Can I access Macros with Win32::API? What dll do I reference? I am not sure how to access a Win32 macro via Perl. Any ideas?

        No, you cannot use the macros, but you should be able to use the Win32::GUI sendmsg() call to send TVM_GETNEXTITEM messages to iterate the contents of the treeview control.

        I don't think that there is an Win32 API call for retrieving that information.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
Reaped: Re: Enumerate a Win32 Treeview
by NodeReaper (Curate) on Jul 25, 2005 at 21:54 UTC
    This node was taken out by the NodeReaper on Tue Aug 2 18:38:57 2005 GMT
    Reason: [Arunbear]: Delete: dup of 477989. (Downvotes also needed for reaping)

    For more information on this node visit: this

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://477964]
Approved by ghenry
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2014-08-22 23:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (168 votes), past polls