请教:关于判断程序是否重复运行的问题
Load事件If App.PrevInstance Then
MsgBox "程序重复打开"
End
End Sub
Unload事件
Dim frm As Form
For Each a In VB.Forms
Unload a
单击程序一次,任务管理器中此程序就多一个进程,请教大家给个代码,解决头痛的问题
谢谢!!!
2011-07-13 16:30
程序代码:
Option Explicit
Private Sub Form_Load()
If App.PrevInstance Then
Call MsgBox("This program has been executed", vbCritical, "Warning")
End
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim Message As String
Message = "Do you sure to quit " + Form1.Caption + "?"
If MsgBox(Message, vbQuestion + vbYesNo, Form1.Caption) = vbNo Then
Cancel = True
End If
End Sub

2011-07-13 17:02
2011-07-13 17:39

2011-07-13 17:54
2011-07-13 18:17
2011-07-13 21:20
2011-07-14 19:42
2011-07-14 23:50