Bad news: I can't find any existing module to do this.
Good news: Win32::API can be used to access all system calls and any DLL using only Perl and no compiler. The system call in question appears to be LockWorkStation.
Update: It might be as simple as the following (untested) code:
use Win32::API (); Win32::API->Import("user32", "BOOL LockWorkStation()"); LockWorkStation();
Update: Here's a tested version with error checking:
use Win32::API (); Win32::API->Import("user32", "BOOL LockWorkStation()") or die("Unable to import LockWorkStation: $^E\n"); LockWorkStation() or die("Unable to lock workstation: $^E\n");
If Import returns false and $^E is numerically equal to 127 ("The specified procedure could not be found"), then it's probably because the function is not required on that particular OS.
In reply to Re: lock WinXP Desktop with perl
by ikegami
in thread lock WinXP Desktop with perl
by marcpascual
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |