Thread: RE: [GD-Windows] Detecting locked screen
Brought to you by:
vexxed72
From: Steve L. <st...@mi...> - 2004-09-22 18:48:17
|
You can check if it has happened: bool CheckForDesktopAvailable(void) { bool bAvailable =3D false; =20 // Check to see if the desktop is locked HDESK hDesk =3D OpenDesktop("Default", 0, FALSE, DESKTOP_SWITCHDESKTOP); if (hDesk) { if (SwitchDesktop(hDesk) !=3D 0) { bAvailable =3D true; } CloseDesktop(hDesk); } return (bAvailable); } =20 AFAIK there is no message to tell you when it happens... -----Original Message----- From: gam...@li... [mailto:gam...@li...] On Behalf Of Brian Hook Sent: Wednesday, September 22, 2004 11:33 AM To: gam...@li... Subject: [GD-Windows] Detecting locked screen I'm trying to detect when the user has chosen to lock their workstation (via Task Manager or an app that calls LockWorkStation() directly), and I can't seem to find a simple way of doing this. I don't need to do anything, I just need to know if it's occurred or not. I was hoping there was some WM_LOCKWORKSTATION or something equivalent, but the nearest I can find is WM_ENDSESSION which isn't quite what I'm looking for. There is no WM_SYSCOMMAND type that is appropriate as well. Most stuff I see recommend installing a GINA DLL, but that may not be possible since the workstation user might have limited rights. If it's something as cheezy as doing a FindWindow for the Logon screen, that would work too, but I'm not sure what that window is called or if it's present all the time and just invisible unless locked, etc. Any pointers appreciated. Thanks, Brian ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |
From: Lewin, G. <gl...@ea...> - 2004-09-22 22:18:46
|
What you want are winlogon notification events http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/secaut= h n/security/winlogon_notification_packages.asp=20 _________________________________________ Gareth Lewin - http://www.garethlewin.com "Facts are useless. You can use facts to prove anything that's even remotely true. Facts shmacts!" -- Homer Jay Simpson. -----Original Message----- From: Brian Hook [mailto:ho...@bo...]=20 Sent: Wednesday, September 22, 2004 1:56 PM To: gam...@li... Subject: RE: [GD-Windows] Detecting locked screen > You can check if it has happened: Thanks, that helps, but it doesn't quite solve it. SwitchDesktop() will still fail if the screen saver has turned on but the actual lock hasn't occurred. There is a very brief interval (under a couple seconds) when the screen saver kicks in and it WON'T lock the desktop, and SwitchDesktop() will fail then even if the desktop hasn't actually been locked (i.e. you can tap a key or move the mouse and the screensaver turns off and there's no logon box). Basically I'm looking for a fictitious API that is like: if ( WorkstationLocked() ) .... Failing that, being able to process a LockWorkstation() or whatever would do the trick as well. Thanks, Brian ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |
From: Brian H. <ho...@bo...> - 2004-09-23 00:11:59
|
> What you want are winlogon notification events Which require installing a DLL which I believe requires Admin privileges (the stuff I've seen requires you to edit HKLM in the registry). So unfortunate I can't use that =3D/ Brian |
From: Lewin, G. <gl...@ea...> - 2004-09-23 01:05:24
|
Ok, another option is http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/termse= r v/termserv/wtssession_notification_str.asp But that's xp only. :(=20 _________________________________________ Gareth Lewin - http://www.garethlewin.com "Facts are useless. You can use facts to prove anything that's even remotely true. Facts shmacts!" -- Homer Jay Simpson. -----Original Message----- From: Brian Hook [mailto:ho...@bo...]=20 Sent: Wednesday, September 22, 2004 5:12 PM To: gam...@li... Subject: RE: [GD-Windows] Detecting locked screen > What you want are winlogon notification events Which require installing a DLL which I believe requires Admin privileges (the stuff I've seen requires you to edit HKLM in the registry). So unfortunate I can't use that =3D/ Brian ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |
From: Brian H. <ho...@bo...> - 2004-09-22 20:56:21
|
> You can check if it has happened: Thanks, that helps, but it doesn't quite solve it. SwitchDesktop() will still fail if the screen saver has turned on but the actual lock hasn't occurred. There is a very brief interval (under a couple seconds) when the screen saver kicks in and it WON'T lock the desktop, and SwitchDesktop() will fail then even if the desktop hasn't actually been locked (i.e. you can tap a key or move the mouse and the screensaver turns off and there's no logon box). Basically I'm looking for a fictitious API that is like: if ( WorkstationLocked() ) .... Failing that, being able to process a LockWorkstation() or whatever would do the trick as well. Thanks, Brian |