WinForm判断窗口是如何关闭的
Private Sub Form1_Closing()Sub Form1_Closing(ByVal sender As Object,ByVal e As System.ComponentModel.CancelEventArgs) _
Handles MyBase.Closing
Dim O As System.Diagnostics.StackTrace = _
New System.Diagnostics.StackTrace(True)
Dim F As System.Diagnostics.StackFrame
F = O.GetFrame(7)
Select Case F.GetMethod.Name.ToString
Case "SendMessage"
MsgBox("你用me.close()来关的吧.")
Case "CallWindowProc"
MsgBox("你点X按钮了吧")
'在这里加你的代码
Case "DispatchMessageW"
MsgBox("你用任务管理器来关的吧")
Case Else
MsgBox("不晓得你是怎么关的")
End Select
End Sub
0 Comments:
Post a Comment
<< Home