Ron Arts wrote: > > 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.
Your window will now receive WM_WTSSESSION_CHANGE messages. There's a sample at http://wiki.wxpython.org/MonitoringWindowsUsb that provides a wxPython mixin class that allows you to capture arbitrary window messages. When using this, you'd just say: self.addMsgHandler( WM_WTSSESSION_CHANGE, self.onSessionChange ) self.hookWndProc() def onSessionChange( self, wParam, lParam ): ... WM_WTSSESSION_CHANGE is 0x02b1. > Also, is this the appropriate method as the docs state that it > requires Windows Terminal > Services loaded (which I don't have running). Starting with XP, all systems run with Windows Terminal Services enabled. That's how fast user switching is implemented, among other things. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32