LockWorkStation (user32)
Last changed: -91.119.3.204

.
Summary

C# Signature:

[DllImport("user32.dll", SetLastError = true)]
static extern bool LockWorkStation();

VB Signature:

<DllImport("user32.dll", SetLastError=True)> _
Public Shared Function LockWorkStation() As Boolean
End Function

User-Defined Types:

None.

Notes:

LockWorkStation uses LastError

Tips & Tricks:

Please add some!

Sample Code:

    void LockWorkStationSafe()
    {
        bool result = LockWorkStation();

        if( result == false )
        {
        // An error occured
        throw new Win32Exception( Marshal.GetLastWin32Error() );
        }
    }

Alternative Managed API:

Do you know one? Please contribute it!

Documentation