How can you lock your Windows NT based Workstation programmatically? To do this, you just need a little basic knowledge on how to use user32.dll
. Here you will find a function name as
and you need to know how to call this function. A sample example with the description of the function
is given below:
LockWorkStation(): Locks the workstation's display. Locking a workstation protects it from unauthorized use.
This function has no parameters.
If the function succeeds, the return value is nonzero. Because the function executes asynchronously, a nonzero return value indicates that the operation has been initiated. It does not indicate whether the workstation has been successfully locked.
If the function fails, the return value is zero. To get extended error information, call
. More information can be found at http://msdn.microsoft.com/en-us/library/aa376875%28VS.85%29.aspx
Private Sub LockWinNTWorkStation()
Catch ex As Exception
MsgBox("This is not relevant for " _
& Environment.OSVersion.ToString() _
& ". Windows NT based Operating System is required.", MsgBoxStyle.Exclamation)