Thought someone might find it slightly useful. This code simply either locks the PC or logs it off. The flags can be used to even cause a shutdown but the way it is here just causes a logoff. Check out the MSDN pages to see all the flags. Could be good for a task scheduler program written in QB64.
'a = ExitWindowsEx(0, 0) 'logoff
a = LockWorkStation 'lock pc