[python-win32] I want to get a message when the screen is locked/unlocked. How?

Ron Arts ron.arts at neonova.nl
Tue Aug 25 13:26:20 CEST 2009


Hi,

I want to logout the user from a remote session when the desktop is locked, and log her in again when it is unlocked.

There seem to be various ways of catching these events:

- WTS API
- ISensLogon Interface (SENS)
- Using Service Control Manager (SCM) Notifications (only for services?)
- Winlogon Notification Packages (deprecated and removed from Vista)

I currently am trying the following (using WTS API):

   if "wxMSW" in wx.PlatformInfo:
       import win32ts
       win32ts.WTSRegisterSessionNotification(self.GetHandle(), win32ts.NOTIFY_FOR_THIS_SESSION)

This does not throw errors at me, but now I am baffled as how I can catch the WTS events.
Also, is this the appropriate method as the docs state that it requires Windows Terminal
Services loaded (which I don't have running).

On the other hand SENS seems to be a good approach as well, but I can't find that
in the pywin32 package.

Can someone shed some light on this?

Thanks,
Ron Art

-- 
NeoNova BV
innovatieve internetoplossingen

http://www.neonova.nl  Science Park 140           1098 XG Amsterdam
info: 020-5611300      servicedesk: 020-5611302   fax: 020-5611301
KvK Amsterdam 34151241

Op dit bericht is de volgende disclaimer van toepassing:
http://www.neonova.nl/maildisclaimer


More information about the python-win32 mailing list