[求助]关于VB中调用API函数ExitWindowsEx的问题?
今日看到VB程序设计中可以用下列API函数来调用关机,重启和注销操作,自己尝试了一下发现并不如自己预期的效果:
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Const SHUTDOWN = 1
Const REBOOT = 2
Const LOGOFF = 0
......
Private Sub Command1_Click()
sh = ExitWindowsEx(SHUTDOWN, dwReserved)
End Sub
Private Sub Command2_Click()
sh = ExitWindowsEx(REBOOT, dwReserved)
End Sub
Private Sub Command3_Click()
sh = ExitWindowsEx(LOGOFF, dwReserved)
End Sub
运行中发现系统能进行注销(Command3_Click())操作外,关机和重启均无反应。
所以想问一下原因?还有其他相关调用关机的操作命令吗?这个和操作系统应该没有关系的吧,我是XP SP2
[此贴子已经被作者于2007-6-26 22:28:58编辑过]