Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 ( #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.
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
Node Status?
node history
Node Type: note [id://1073647]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2014-10-20 23:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (93 votes), past polls