Hi,
I have one MFC application which has 2 radio buttons.
O Chick Here O Click there
by default "Click there" will be selectted....But i want only "Click
here" to be checked....but interestingly "both" the radio buttons
will be checked...
I want only that "Click here" to be selected....How can i achieve
this??...
My code is here
[code]
#!/usr/bin/perl -w
use strict;
use Win32;
use Win32::Process;
use Win32::GuiTest qw(:ALL);
# path to where the perl interpreter resides
my $perl = 'c:\Perl\bin\perl.exe';
my $i;
# path to the tested program (current directory)
my $program = 'hope.pl';
my $text;
my @button;
# tested program handler as "returned" by Process::Create
my $process_object;
# list of windows; we use this to keep all found windows
# returned by FindWindowLike()
my @windows;
my @hnds;
Win32::Process::Create( $process_object, "C:\\Program Files\\HP
StorageWorks Library and Tape Tools\\TT.exe", "",0,
NORMAL_PRIORITY_CLASS, ".", )
|| die "Could not spawn process";
sleep 3;
@windows = FindWindowLike( undef, "TT - Startup", "" );
print $windows[0];
$text=GetWindowText($windows[0]);
print "\n".$text;
@button=FindWindowLike($windows[0],"","Button");
click_on_the_middle_of_window($windows[0]);
sleep 2;
foreach $i(@button)
{
$text=GetWindowText($i);
if($text eq "Click here")
{ CheckButton($i);}
}
sub click_on_the_middle_of_window {
# the window handle of the window we will click on
my $window = shift;
print
"* Moving the mouse over the window id: $window\n";
# get the coordinates of the window
my ( $left, $top, $right, $bottom ) =
GetWindowRect($window);
# now we move the mouse right in the middle of the
# window
MouseMoveAbsPix( ( $right + $left ) / 2,
( $top + $bottom ) / 2 );
# ;-)
sleep(1);
# send LEFT CLICK event
print "* Left Clicking on the window id: $window\n";
SendMouse("{LeftClick}");
sleep(1);
}
[/code]