Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: How to execute win32 functions when the user session is locked.

by bulk88 (Priest)
on Feb 06, 2014 at 05:16 UTC ( [id://1073647]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to execute win32 functions when the user session is locked.
in thread How to execute win32 functions when the user session is locked.

You need to remove the concept of "active window" and "foreground window" from your script. Once your remove those 2, and send the "keys" to the *background*ed window, it will work. http://forums.codeguru.com/showthread.php?313632-quot-Sendkeys-quot-problem-while-computer-locked . Notice SendKeys doesn't ask for a HWND. You need something that takes a HWND or object equivalent. SendKeys is a wrapper for http://msdn.microsoft.com/en-us/library/windows/desktop/ms646304%28v=vs.85%29.aspx. If the lock screen is the foreground window, where do you think your key presses will go assuming they aren't blocked for security reasons?
  • Comment on Re^3: How to execute win32 functions when the user session is locked.

Replies are listed 'Best First'.
Re^4: How to execute win32 functions when the user session is locked ( hwndSendKeys )
by Anonymous Monk on Feb 06, 2014 at 08:41 UTC

    Here is hwndSendKeys , its close, but its broken (and i'm bored with it)

    sub hwndSendKeys { my ( $hwnd, $keys, $delay) = @_; $delay = 25 unless defined $delay; $delay /= 1000; my @k = Win32::GuiTest::parse_keys($keys); for ( my $i = 0; $i < @k; $i+=2) { if ( defined $k[$i]) { Win32::GuiTest::DbgShow("SendRawKey(@k[$i,$i+1])\n"); #~ Win32::GuiTest::SendRawKey( @k[$i,$i+1]); my( $key, $updown ) = @k[ $i, $i+1 ] ; my $wmupdown = WM_KEYDOWN(); $wmupdown = WM_KEYUP() if $updown == 2; Win32::GuiTest::PostMessage( $hwnd, $wmupdown, $key , 0 + ); select(undef,undef,undef,$delay); ## deprecated $i+=2; ### SUPER BROKEN otherwise DOUBLING bug } else { $k[$i+1]-> (); } } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1073647]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-25 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found