30-09-12, 09:35 PM
عفوا كان في خطأ بسيط في الأمر واللي هو رقم 1 المفروض يكون رقم 0 ...
كود :
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Processes As Process() = Process.GetProcessesByName("notepad")' البحث عن عمليات برنامج المفكرة
If [color=#ff0000]Processes.Count > 0[/color] Then ' إذا وجد البرنامج أي عملية
For Each Process In Processes
If Process.MainWindowTitle.StartsWith("s.txt") Then ' البحث في عناوين العمليات عن اسم الملف
Pname.Text = "File Opened"
Me.Hide()
Form1.Show()
Process.WaitForExit()
Pname.Text = "File Closed"
Form1.Hide()
Me.Show()
Exit For
End If
Next
End If
End Sub