赞美茶艺的诗句,谁知道怎样用VB编程序关机?
答案:1 悬赏:20 手机版
解决时间 2021-05-17 14:48
- 提问者网友:骑士
- 2021-05-17 06:39
赞美茶艺的诗句,谁知道怎样用VB编程序关机?
最佳答案
- 五星知识达人网友:野慌
- 2021-05-17 07:56
'晕!我刚刚才做了一个,把代码给你。(怎么这么巧啊?)
'你需要画一个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 ExitWindowsEx function either logs off, shuts down, or shuts
'down and restarts the system.
Private Declare Function ExitWindowsEx 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 Lon......余下全文>>
'你需要画一个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 ExitWindowsEx function either logs off, shuts down, or shuts
'down and restarts the system.
Private Declare Function ExitWindowsEx 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 Lon......余下全文>>
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯