How to determine if the pc is locked

new2this

Member
Joined
Nov 20, 2009
Messages
15
Location
Durban, KwaZulu-Natal, South Africa
Programming Experience
Beginner
Hi guys

i need help from the experts again :D

i need my application to determine if the desktop of the pc is locked or open.

how would i go about doing this? i know that it is something to do with the registry but i dont know how to go about getting the values

thanks
 
i found a solution here is the code below

Imports Microsoft.Win32
Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler SystemEvents.SessionSwitch, AddressOf checkLockUnlock
End Sub

Public Sub checkLockUnlock(ByVal sender As Object, ByVal e As SessionSwitchEventArgs)
If e.Reason = SessionSwitchReason.SessionLock Then
ListBox1.Items.Add("locked")
Else
ListBox1.Items.Add("unlocked")
End If
End Sub
End Class
 
Back
Top