تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
ممكن تعديل بسيط على هذا المشروع
#1
انا عاوز اول لما تفتح s.txt Form1 show and Form Hide
عملت موضوع لاكن لم يتم الحل الموضوع القديم
كود المشروع

كود :
Imports System.Runtime.InteropServices
Public Class Form
    Dim Selectd As Integer, Big As Long
    Private Const AW_BLEND = &H1
    Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Int32, ByVal dwTime As Int32, ByVal dwFlags As Int32) As Boolean
    Dim winHide As Integer = &H1
    Dim winBlend As Integer = &H1

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Static a As Integer
        a = a + 1
        If a = 25 Then
            AnimateWindow(Me.Handle.ToInt32, CInt(1), winHide Or winBlend)
            Timer2.Enabled = False
            For Each c As Process In Process.GetProcesses
                If c.MainWindowTitle = "s.txt - Notepad" Then
                    Me.Hide()
                    Form1.Show()
                End If
            Next
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Select Case Selectd
            Case 1
                Pname.Text = "                                                                   Wait File Open"
                Dim path = Application.StartupPath + "\s.txt"
                If (System.IO.File.Exists(path)) Then
                    Process.Start(path)
                Else
                    Pname.Text = "File Not Found"
                End If

                Timer1.Enabled = False
        End Select
        Selectd = Selectd + 1

    End Sub
End Class

هذا رابط المشروع
ممكن تصحيح هذا الكود
كود :
If Process.Wait("s.txt") Then
            Me.Hide()
            Form1.Show()
        End If
الرد }}}
تم الشكر بواسطة:
#2
إستبدل الأمر الموجود في Form1 بـ :
كود :
Imports System.Runtime.InteropServices
Public Class Form
    Dim Selectd As Integer, Big As Long
    Private Const AW_BLEND = &H1
    Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Int32, ByVal dwTime As Int32, ByVal dwFlags As Int32) As Boolean
    Dim winHide As Integer = &H1
    Dim winBlend As Integer = &H1

    Private Sub Form_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
        Pname.Text = "Wait File Open"
        Dim path = Application.StartupPath + "\s.txt"
        If (System.IO.File.Exists(path)) Then
            Dim Process As Process = Process.Start(path)
            Pname.Text = "File Opened"
            Me.Hide()
            Form1.Show()
            Process.[color=#ff0000]WaitForExit[/color]()
            Pname.Text = "File Closed"
            Form1.Hide()
            Me.Show()
        Else
            Pname.Text = "File Not Found"
        End If
    End Sub
End Class
الرد }}}
تم الشكر بواسطة:
#3
Osama_Ghareeb كتب :إستبدل الأمر الموجود في Form1 بـ :
كود :
Imports System.Runtime.InteropServices
Public Class Form
    Dim Selectd As Integer, Big As Long
    Private Const AW_BLEND = &H1
    Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Int32, ByVal dwTime As Int32, ByVal dwFlags As Int32) As Boolean
    Dim winHide As Integer = &H1
    Dim winBlend As Integer = &H1

    Private Sub Form_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
        Pname.Text = "Wait File Open"
        Dim path = Application.StartupPath + "\s.txt"
        If (System.IO.File.Exists(path)) Then
            Dim Process As Process = Process.Start(path)
            Pname.Text = "File Opened"
            Me.Hide()
            Form1.Show()
            Process.[color=#ff0000]WaitForExit[/color]()
            Pname.Text = "File Closed"
            Form1.Hide()
            Me.Show()
        Else
            Pname.Text = "File Not Found"
        End If
    End Sub
End Class

جزاك الله كل خير اخى
هل من الممكن بدل استخدام
كود :
Dim path = Application.StartupPath + "\s.txt"
        If (System.IO.File.Exists(path)) Then
            Dim Process As Process = Process.Start(path)
فتح الملف من الخارج ؟
وى عندما يفتح الملف Form تظهر؟
الرد }}}
تم الشكر بواسطة:
#4
كود :
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 Processes.Count > 1 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
الرد }}}
تم الشكر بواسطة:
#5
Osama_Ghareeb كتب :
كود :
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 Processes.Count > 1 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

جزاك الله كل خير وى حماك الله من كل شر
الرد }}}
تم الشكر بواسطة:
#6
لم ينفع هذا الكود أخى
Dim Processes As Process() = Process.GetProcessesByName("notepad")
If Processes.Count > 1 Then
For Each Process In Processes
If Process.MainWindowTitle.StartsWith("s.txt") Then
بفتح الملف لاكن لا شئ يحدوث
الرد }}}
تم الشكر بواسطة:
#7
عفوا كان في خطأ بسيط في الأمر واللي هو رقم 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
الرد }}}
تم الشكر بواسطة:
#8
Osama_Ghareeb كتب :عفوا كان في خطأ بسيط في الأمر واللي هو رقم 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
لم يعمل أيضآ أخى معلش هاتعبك معايه شويه ممكن تعملى مثال صغير؟
الرد }}}
تم الشكر بواسطة:
#9
ارجو منك التقيد بكتابة عنوان واضح لمواضيعك
والابتعاد عن كتابة كلمات ارجوكم سااعدوني مهم جداً وللضرورة و ....الخ
تقيد بمضمون السؤال .

تحياتي لك
ابو سامي
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  ممكن ايضاح اكثر لـ continu for justforit 6 320 05-11-25, 12:10 AM
آخر رد: justforit
  [VB.NET] مساعدة تعديل على الكود ZEEN4ZEEN 2 209 08-10-25, 02:20 PM
آخر رد: salamandal
  تعديل كود تحديث البيانات مصمم هاوي 1 784 26-04-25, 06:07 PM
آخر رد: مصمم هاوي
  تعديل على استدعاء الدرجات حسب الاختيار مصمم هاوي 11 992 15-04-25, 06:16 PM
آخر رد: princelovelorn
  ارجو تعديل الكود بواستطة الاجراء المخزن new_programer 3 676 03-04-25, 02:44 PM
آخر رد: princelovelorn
  تعديل مسار مكان حفظ النسخة الاحتياطية مصمم هاوي 6 806 02-03-25, 01:06 PM
آخر رد: atefkhalf2004
  محتاج تعديل على كود الحذف new_programer 2 652 17-02-25, 06:50 PM
آخر رد: new_programer
  [VB.NET] اذا ممكن مشروع ادارة مدرسة بدر إشتية 4 8,536 08-02-25, 02:05 AM
آخر رد: الورد2
  ارجو تعديل الكود جلب البيانات عن طريق اجراء مخزن - مرفق مثال new_programer 0 620 05-02-25, 01:51 AM
آخر رد: new_programer
  طريقه تحويل اى قاعده بيانات الى ملف dll فى المشروع خالد كامل1 1 636 31-01-25, 10:21 PM
آخر رد: Kamil

التنقل السريع :


يقوم بقرائة الموضوع: