Hi I am trying to retrieve the label displayed of menu item in windows explorer. For that I used win32 Api function GetMenuString( int GetMenuString(HMENU, hMenu, WORD wIDItem, LPSTR lpString, int nMaxCount, WORD wFlag)). But it is not giving right result. I also used GetMenuItemCount. It is giving right number of menu item. If run the below script it result to
Exploring - program found Numer Of menu item : 5 MenuLabel : Can anyone tell where is wrong in my script and why MenuLabel is not showing any string . --------------- use Win32::API; use win32; use Win32::Setupsup qw(EnumWindows GetWindowText EnumChildWindows SetFocus WaitForWindow GetWindowProperties); #getting total number of desktop window EnumWindows(\@windows); $num=0; foreach $ele(@windows) { $num++; } # Finding the explorer window FOR: for ($i=0;$i<$num;$i++) { GetWindowText( @windows->[$i], \$windowtext); if($windowtext eq "Exploring - program") { print "Exploring - program found \n"; $winhandle=@windows->[$i]; last FOR; } } # getting the window handle $GetMenu=new Win32::API("user32","GetMenu",[N],N); $menu=$GetMenu->Call($winhandle); # getting total number of menu item $GetMenuItemCount= new Win32::API("user32", "GetMenuItemCount", [N], N); $n=$GetMenuItemCount->Call($menu); print "Numer Of menu item : $n\n"; # gettiing label of 4th menu item ie Tools $GetMenuString=new Win32::API("user32","GetMenuString", [N,N,P,I,N], I); $lpBuffer = " " x 80; $GetMenuString->Call($menu,3,$lpBuffer,80,MF_BYPOSITION); print "MenuLabel : $lpBuffer"; ------------------------------------- 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]