QB64.org Forum

Active Forums => Programs => Topic started by: SpriggsySpriggs on June 22, 2020, 03:39:08 pm

Title: Lock/Log off PC
Post by: SpriggsySpriggs on June 22, 2020, 03:39:08 pm
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.
Code: QB64: [Select]
  1.     FUNCTION LockWorkStation ()
  2.     FUNCTION ExitWindowsEx (BYVAL flags, BYVAL reason)
  3.  
  4. 'a = ExitWindowsEx(0, 0) 'logoff
  5. a = LockWorkStation 'lock pc