How to get notified in VC6 about workstation unlocking

I need to be notified every time the user unlocks the workstation.

Ok, in VC7 I can register my window using WTSRegisterSessionNotification to be able to proccess in its WindowProc the message WM_WTSSESSION_CHANGE, whose parameters can tell me about locking/unlocking of the workstation.
But this requires VC7, XP...

Is there any way to know that in previous OSs & VC6?

Hernan_BerguanAsked:
Who is Participating?
 
jkrCommented:
You could simply write your own Winlogon Notification Package - see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/winlogon_notification_packages.asp ("Winlogon Notification Packages"). It basically boils down to creating a DLL that has the following functionality

//Event handler for the Winlogon Logon event
VOID WLEventUnlock(PWLX_NOTIFICATION_INFO pInfo)
{
   //Print the name of the handler to debug output.
   //You can replace this with more useful functionality.
   OutputDebugString (TEXT("NOTIFY:  Entering WLEventUnlock.\r\n"));
}

and is registered with the system under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify

DllName = mynotifdll.dll
Unlock = "WLEventUnlock"

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.