none
How to lock and unlock my win 7 workstation using vb.net windows application? RRS feed

Answers

  • Hi Krish,

    Welcome to the MSDN Forum.

    You have this code to lock it: http://msdn.microsoft.com/en-us/library/windows/desktop/aa376875(v=vs.85).aspx 

    For unlock it, please take a look at this thread: http://stackoverflow.com/questions/1351616/how-to-unlock-or-log-in-windows-by-app-itself 

    You really want to write a GINA (for XP) or a Credential Provider for Windows Vista and beyond.

    Fundamentally the Windows authentication model is based on the user providing evidence (identification) that they're authorized to access the computer (either by their credentials or biometric data or smartcard or other information). Once you've been authorized to log onto the computer, Windows allows you access.

    When the workstation is locked (for whatever reason - screen saver, user typing in Win-L) the user needs to be re-authenticated.

    Typically that's sufficient - the authorization is good for a period of time (determined by the administrator). If (for policy reasons) you need a finer grained control model, you could use your "LockWorkstation" idea to force the user to re-authenticate themselves. You need to be VERY careful about false positives (nothing pisses off users more than being told they're not allowed to use their computer simply because they removed their glasses or combed their hair differently) and how much drain on system resources your app causes.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, August 20, 2012 11:09 AM
    Moderator