23-05-13, 12:14 PM
كود :
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim query = From process In System.Diagnostics.Process.GetProcesses() _
Where process.ProcessName.ToLower = "winword" _
Select process.ProcessName
If query.Count = 1 Then
MsgBox("يوجد ملف ويرد مفتوح مسبقاً", MsgBoxStyle.Exclamation, "Error")
Exit Sub
End If
Dim p As New System.Diagnostics.Process
p.StartInfo.FileName = "winword.exe"
p.Start()
End Subنتحقق في البداية عن طريق الـ Linq من وجود نسخة من برنامج الويرد مفتوحة مسبقاً أم لا
إذا ما في يتم فتح نسخة جديدة

