Declare Function LockWorkStation Lib "user32.dll" () As Long
LockWorkStation locks the computer, preventing anybody from entering input until either the user who locked it or an administrator enters his or her password. This function does the same thing as though the user had pressed Ctrl+Alt+Del and selected "Lock Workstation."
If successful, the function returns a non-zero value. If an error occured, the function returns zero (use GetLastError to get the error code).
None.
None.
Lock the workstation when the user clicks the command button named cmdLock. Obviously, to use this example, you must place a command button named cmdLock on a form window.
' This code is licensed according to the terms and conditions listed here.
' Declarations and such needed for the example:
' (Copy them to the (declarations) section of a module.)
Public Declare Function LockWorkStation Lib "user32.dll" () As Long
' *** Place the following code inside the form window. ***
Private Sub cmdLock_Click ()
' Lock the workstation when this button is clicked.
Dim retval As Long ' return value
retval = LockWorkStation()
' That's all there is to it!
End Sub
Back to the Function list.
Back to the Reference section.
Last Modified: December 17, 2000
This page is copyright © 2000 Paul Kuliniewicz.
Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/l/lockworkstation.html