如何用VB接收系统关闭动作,然后延迟系统关闭时间??

来源:百度知道 编辑:UC知道 时间:2024/05/29 19:14:37

刚回答完不久的问题:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = 2 Then'接收系统关闭
sleep(5000) '延时5秒
Cancel = False
Else
Cancel = True
End If
End Sub