> -----Original Message-----
> From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-
> win32-users-boun...@listserv.activestate.com] On Behalf Of Edwards,
> Mark (CXO)
> Sent: 19 September 2011 03:21
> To: Perl-Win32-Users (perl-win32-users@listserv.ActiveState.com)
> Subject: GuiTest and Locked Screen
>
>
> 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~");

AIUI, Win32::GuiTest works by sending window events to specific windows, as the 
windowing system does. It doesn't entirely surprise me that locking the screen, 
and therefore the windowing system, prevents that from working. It's kind of 
what locking the screen is designed to do.

Another method of communicating with, or controlling, the other application 
that doesn't use the windowing system might work better. OLE, for example.

HTH

--
Brian Raven

Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient or have received this e-mail in error, please advise 
the sender immediately by reply e-mail and delete this message and any 
attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to