I have a simple Win32::GuiTest example where I find a Notepad window, print its 
handle and title and then send some keys to it.   When I open Notepad and the 
run the script I see...

4915356: Untitled - Notepad
 Notepad pops up on top of other windows and "Testing 123" shows up in Notepad 
as expected.

Here's the problem.  I need this to work with the screen locked.  When I lock 
the screen and give it time to run, I still get the handle and window title but 
no keys get sent to Notepad.  It seems like it never get set as the foreground 
window since it's not on top after I unlock the screen. 

I tried SetForegroundWindow, SetActiveWindow and SetFocus but none seems to 
make it the current window.

Any suggestions?

#################################################################################
use warnings;
use strict;
use Win32::GuiTest qw(SetFocus SetActiveWindow FindWindowLike 
SetForegroundWindow SendKeys GetWindowText);

sleep 15;  #Give me time to lock the screen
my ($winid)=FindWindowLike(0, "Notepad");
print "$winid: ", GetWindowText($winid), "\n";
#SetForegroundWindow($wind);
#SetActiveWindow($winid);
SetFocus($winid);
sleep 3;
SendKeys("Testing 123~");
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to