/ Published in: VB.NET
Force Logoff in VB.NET via InteropServices
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Imports System.Runtime.InteropServices Public Class Form1 <Flags()> _ Enum ExitWindows As UInteger LogOff = &H0 ShutDown = &H1 Reboot = &H2 PowerOff = &H8 RestartApps = &H40 ' plus AT MOST ONE of the following two: Force = &H4 ForceIfHung = &H10 End Enum Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Int32, ByVal dwReserved As Int32) As Int32 Private Sub ForceLogoffNow() Call ExitWindowsEx(ExitWindows.LogOff, ExitWindows.Force) End Sub