3个回答
展开全部
'API声明
Public Declare Function RtlAdjustPrivilege& Lib "ntdll" (ByVal Privilege&, ByVal NewValue&, ByVal NewThread&, OldValue&)
Public Declare Function NtShutdownSystem& Lib "ntdll" (ByVal ShutdownAction&)
Public Const SE_SHUTDOWN_PRIVILEGE& = 19
Public Const shutdown& = 0
Public Const RESTART& = 1
Public Const POWEROFF& = 2
'过程
Sub TurboShutdown()
RtlAdjustPrivilege SE_SHUTDOWN_PRIVILEGE, 1, 0, 0
NtShutdownSystem shutdown '关机
'NtShutdownSystem restart '重启动
'NtShutdownSystem poweroff '关机
End Sub
'调用
call turboshutdown
Public Declare Function RtlAdjustPrivilege& Lib "ntdll" (ByVal Privilege&, ByVal NewValue&, ByVal NewThread&, OldValue&)
Public Declare Function NtShutdownSystem& Lib "ntdll" (ByVal ShutdownAction&)
Public Const SE_SHUTDOWN_PRIVILEGE& = 19
Public Const shutdown& = 0
Public Const RESTART& = 1
Public Const POWEROFF& = 2
'过程
Sub TurboShutdown()
RtlAdjustPrivilege SE_SHUTDOWN_PRIVILEGE, 1, 0, 0
NtShutdownSystem shutdown '关机
'NtShutdownSystem restart '重启动
'NtShutdownSystem poweroff '关机
End Sub
'调用
call turboshutdown
参考资料: http://www.mndsoft.com/blog/article.asp?id=131
展开全部
在xp中一句代码就可以的:
shell "cmd /c shutdown -s -f -t 0"
shell "cmd /c shutdown -s -f -t 0"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
启动记事本,输入一下文字
保存成form.frm
双击打开,点文件-保存工程,随便保存一下
点文件-生成工程1.exe,然后运行程序。
如果想让它开机自动运行,可以将它移动到开始-程序-启动中
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Interval = 1000
Left = 1800
Top = 1320
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Me.Hide
End Sub
Private Sub Timer1_Timer()
If Str(Time) = "20:00:00" Then '20:00:00是关机的时间
Open App.Path & "\CONAN.bat" For Output As #1
Print #1, "@Shutdown -s -f -t 1"
Close #1
Shell App.Path & "\CONAN.bat"
End If
End Sub
或者
Open App.Path & "\CONAN.bat" For Output As #1
Print #1 ,"@Shutdown -s -f -t 1"
Close #1
Shell App.Path & "\CONAN.bat"
保存成form.frm
双击打开,点文件-保存工程,随便保存一下
点文件-生成工程1.exe,然后运行程序。
如果想让它开机自动运行,可以将它移动到开始-程序-启动中
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Interval = 1000
Left = 1800
Top = 1320
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Me.Hide
End Sub
Private Sub Timer1_Timer()
If Str(Time) = "20:00:00" Then '20:00:00是关机的时间
Open App.Path & "\CONAN.bat" For Output As #1
Print #1, "@Shutdown -s -f -t 1"
Close #1
Shell App.Path & "\CONAN.bat"
End If
End Sub
或者
Open App.Path & "\CONAN.bat" For Output As #1
Print #1 ,"@Shutdown -s -f -t 1"
Close #1
Shell App.Path & "\CONAN.bat"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询