Hi 
I am finding out handle to a window and menu of that window. In below
mentioned script I am finding window with title "PCE - [api-getmenu]" and
printing its handle and handle to it's menu.

My problem is every time I open the window and run the program,it gives
different handle to both window and it;s menu. Is it normal or something
wrong ?
Is window give different handle number every time window is opened ?

Thanking you

Abhra


-------------------------------------
use Win32::API;
use win32; 
 
use Win32::Setupsup qw(EnumWindows GetWindowText EnumChildWindows SetFocus 
                                      WaitForWindow GetWindowProperties);

EnumWindows(\@windows); # enumerating all window in desktop

$num=0;

foreach $ele(@windows)
{
        $num++;
}

#Finding out the window with title 'PCE - [api-getmenu]'

FOR: for ($i=0;$i<$num;$i++)
{
        GetWindowText( @windows->[$i], \$windowtext); 
        if($windowtext eq "PCE - [api-getmenu]")      # checking title of
the window
        {
                print "Window PCE - [api-getmenu] found \n";
                $winhandle=@windows->[$i];
                last FOR;
         }
 }

print  "WindowHandle : $winhandle";

$GetMenu=new Win32::API("user32","GetMenu",[N],N);
$menu=$GetMenu->Call($winhandle);

print "Menu handle:$menu \n";

Abhra Debroy
Prabodhan Exports Pvt. Ltd.(www.prabodhan.com - Join our QA Club!)
Tel: 91-20-5462035,543 1447



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to