三九宝宝网宝宝成长宝宝手工

怎么利用vb制作个快速关机程序

01月06日 编辑 39baobao.com

'你需要画一个timer,名字叫timer1,然后把代码复制就可以了。 Option Explicit Private Const EWX_LogOff As Long = 0 Private Const EWX_SHUTDOWN As Long = 1 Private Const EWX_REBOOT As Long = 2 Private Const EWX_FORCE As Long = 4 Private Const EWX_POWEROFF As Long = 8 'The ExitWindow〖HmhK〗环保过滤 function either logs off, shuts down, or shuts 'down and restarts the system. Private Declare Function ExitWindow〖HmhK〗环保过滤 Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long 'The GetLastError function returns the calling thread's last-error 'code value. The last-error code is maintained on a per-thread basis. 'Multiple threads do not overwrite each other's last-error code. Private Declare Function GetLastError Lib "kernel32" () As Long Private Type LUID UsedPart As Long IgnoredForNowHigh32BitPart As Long End Type Private Type LUID_AND_ATTRIBUTES TheLuid As LUID Attributes As Long End Type Private Type TOKEN_PRIVILEGES PrivilegeCount As Long TheLuid As LUID Attributes As Long End Type 'The GetCurrentProcess function returns a pseudohandle for the 'current process. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long 'The OpenProcessToken function opens the access token associated with 'a process. Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, _ ByVal DesiredAccess As Long, TokenHandle As Long) As Long 'The LookupPrivilegeValue function retrieves the locally unique 'identifier (LUID) used on a specified system to locally represent 'the specified privilege name. Private Declare Function LookupPrivilegeValue Lib "advapi32" _ Alias "LookupPrivilegeValueA" _ (ByVal lpSystemName As String, _ ByVal lpName As String, _ lpLuid As LUID) As Long 'The AdjustTokenPrivileges function enables

推荐阅读
图文推荐