Search This Blog

Tuesday, August 11, 2009

To lock your machine programmatically

To lock your machine programmatically you can use the API LockWorkStation().

Syntax
C++

BOOL WINAPI LockWorkStation(void);


//Code:
if( !LockWorkStation())
{
// Failed to lock the machine
}

This function has the same result as pressing Ctrl+Alt+Del and clicking Lock Workstation. To unlock the workstation, the user must log in. There is no function you can call to determine whether the workstation is locked.

No comments: