请教:关于判断程序是否重复运行的问题
Load事件If App.PrevInstance Then
MsgBox "程序重复打开"
End
End Sub
Unload事件
Dim frm As Form
For Each a In VB.Forms
Unload a
单击程序一次,任务管理器中此程序就多一个进程,请教大家给个代码,解决头痛的问题
谢谢!!!
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