VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - VB中关闭windows
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:10001, 日期:2001-04-18
注释:Api function and the constants required for ExitWindowsEx
Declare Function ExitWindowsEx& Lib "user32" (ByVal uFlags As Long, _
                                              ByVal dwReserved As Long)

Public Const EWX_FORCE = 4
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_SHUTDOWN = 1

Private Sub cmdShutdown_Click()

Dim MsgRes As Long

注释:Make sure that the user really want to shutdown
MsgRes = MsgBox("Are you sure you want to Shut Down Windows 95?", vbYesNo Or vbQuestion)

注释:If the user selects no, exit this sub
If MsgRes = vbNo Then Exit Sub

注释:else, shutdown windows and unload this form
Call ExitWindowsEx(EWX_SHUTDOWN, 0)
Unload Me

End Sub