Advertisement
7_2009-2012 Coding Standards #235289

Instance Checker

This simple few lines of code will give the user and error message if they are already running your program. Doesn't apply if you are in the ide!

AI

ملخص الذكاء الاصطناعي: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

كود المصدر
original-source
Private Sub Form_Load() ' the form1 loading sub
If App.PrevInstance Then ' check if running
  MsgBox "Error:" & vbCrLf & "Please switch to your already running app." ' error message
 Dim frm As Form ' set frm variable as a form
 For Each frm In Forms ' get all forms
  Unload frm ' unload the form
  Set frm = Nothing ' set frm variable as nothing
 Next frm ' go to the for each frm again
 End If ' end the if statement
End Sub ' end the form load
التعليقات الأصلية (3)
مسترجع من Wayback Machine