السلام عليكم ورحمة الله وبركاته
أريد كود : للتأكد من أن البرنامج يعمل بالفعل ولا يتشغيل البرنامج مرة أخرى بنفس الوقت
حيث إذا كان البرنامج يعمل بالفعل لا يتم تشغيله مرة اخرى
وعليكم السلام ورحمة الله وبركاته
تفضل :
كود :
Function AnotherInstance() As Integer
Dim AppTitle$
If App.PrevInstance Then
' Hold the title of the application (title bar caption)
AppTitle$ = App.Title
' Change our application title
App.Title = "No longer want this app running..."
' Activate the previous instance
AppActivate AppTitle$
' Let calling procedure know another instance was detected
AnotherInstance = True
Else
' Let calling procedure know another instance was NOT detected
AnotherInstance = False
End If
End Function
Sub Form_Load()
' Don't want two copies of the program running at the same time
If AnotherInstance() Then End
' Note: that this routine will not work if the application's title changes
' (showing file names in the title bar for example).
End Sub
لكم جميعا جزيل الشكر والتقدير وبارك الله فيكم
(28-12-21, 09:08 PM)hamada salah90 كتب : [ -> ]لكم جميعا جزيل الشكر والتقدير وبارك الله فيكم
فى ال form load لاول شاشة بالبرنامج :
If App.PrevInstance = True Then
N = MsgBox("البرنامج يعمل", vbRetryCancel + vbCritical, "M.Ezzat")
Unload Me
Exit Sub
End If