تقييم الموضوع :
  • 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
ارجو منك التقيد بكتابة عنوان واضح لمواضيعك
والابتعاد عن كتابة كلمات ارجوكم سااعدوني مهم جداً وللضرورة و ....الخ
تقيد بمضمون السؤال .

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


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  تعديل على فاتورة مبيعات خالد كامل1 4 68 26-03-24, 10:49 PM
آخر رد: خالد كامل1
  تعديل كود ارسال صورة الى الواتس new_programer 2 114 21-03-24, 10:07 PM
آخر رد: new_programer
  تعديل صب المجموع الكلي والمعدل والتقدير مصمم هاوي 3 130 19-03-24, 01:33 AM
آخر رد: مصمم هاوي
  تعديل طول حقل معين في جميع جداول القاعدة atefkhalf2004 1 97 09-03-24, 03:17 AM
آخر رد: atefkhalf2004
  تعديل بيانات عمود DataGridView دفعة واحدة مصمم هاوي 2 164 05-03-24, 08:27 PM
آخر رد: مصمم هاوي
  ممكن حل المشكلة فى الكود التالي - من مشاركة استاذنا القدير / عبدالله الدوسري new_programer 4 169 02-03-24, 07:36 PM
آخر رد: new_programer
  كيفية حفظ وتحزيم المشروع وتشغيله كبرنامج علىجميع الاجهزة الرائد 3 1,123 18-02-24, 10:37 PM
آخر رد: الحزين اليماني
Sad ممكن حل لهذا المشكل melad2002 0 239 30-01-24, 08:01 PM
آخر رد: melad2002
  ممكن استفسار عن m3u8 malekmohamed155 0 232 20-01-24, 07:47 PM
آخر رد: malekmohamed155
  [VB.NET] تحويل المشروع سطح المكتب للعمل على الويب Doby 3 359 13-01-24, 04:22 AM
آخر رد: dr.programming

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


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم