How exactly is this other window with toolbar created? Is it from a completely separate script or from a module that your script loads? Is it created using Win32::GUI in Perl? Could you provide a small example of your problem?

Sorry for the confusion.

Thanks for the update. The one you have referred will get the tool bar button count for which you create the window and add content to that window and you are getting the same.
But I look for the  situation, where I have to get the Toolbar button count on existing window which I will not create on run time.
I am looking some solution on the same . Any further thoughts from you is very much helpful.
Thx in advance and I  hope that I have clarified my requirement.
Selva D

--- On Mon, 10/5/10, Kevin Marshall <> wrote:

From: Kevin Marshall <>
Subject: RE: [perl-win32-gui-users] Is it possible to work on toolbar controls with win32::GUI
Cc: "Perl-Win32-GUI-Users List" <>
Date: Monday, 10 May, 2010, 7:44 AM


You can use the ButtonCount() method to retrieve the number of buttons in the toolbar and the GetButtonText() method to retrieve the text of the specified button. Here is some sample code:

use strict;
use warnings;

use Data::Dump qw(dump);
use Win32::GUI qw();

my $win = Win32::GUI::Window->new(
    -name => 'win',

    -text => 'Toolbar Sample',
    -size => [320,240],
    -left => CW_USEDEFAULT,

    -name => 'toolbar',
    -adjustable => 1,
    -flat => 1,
    -multiline => 1,
    -nodivider => 1,
my @buttons = (qw(Cut Copy Paste Undo Redo Delete New Open Save Preview
    Properties Help Find Replace Print));
$win->toolbar->AddString($_) foreach @buttons;
    scalar @buttons,
    map {($_,$_+1,TBSTATE_ENABLED,BTNS_SHOWTEXT,$_)} 0..$#buttons



sub win_Resize {
    return 1;

sub toolbar_ButtonClick {
    my($index,$dropdown) = @_;
    printf "Button %02d of %02d text => %s\n", $index,
        $win->toolbar->ButtonCount(), $win->toolbar->GetButtonText($index);
    return 1;

Hope this helps,


> Date: Tue, 4 May 2010 05:38:04 -0700
> From:
> To:
> Subject: [perl-win32-gui-users] Is it possible to work on toolbar controls with win32::GUI
> Hi,
> I exhaustively looked at win32::GUI and please clarify on the same.
> I just want to get the toolbar item- count and also the text of the items in toolbar. I saw win32::GUI was creating an window and doing adding some control for the same.
> Is there any way to test the toolbar controls for the existing toolbar by passing the window handler.
> I also tried with win32::GUItest..but not succeeded.(by using sendmessage ) Please any clue on this?
> Thanks
> Selva D
> ------------------------------------------------------------------------------
> _______________________________________________
> Perl-Win32-GUI-Users mailing list

Looking for a hot date? View photos of singles in your area!