Program Suspend ve Resume

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Uzman Üye
Katılım
15 Eyl 2016
Mesajlar
203
Çözümler
2
Tepki puanı
16
Ödüller
5
9 HİZMET YILI
Merhaba Dostlar | Kodlar Globaldir Başka Yerlerden de Ulaşabilirsiniz.

Bu kodlar ile istediğiniz uygulamayı durdurup tekrardan devam ettirebilirsiniz.

Form Üstüne Gelicek Kodlar ;

Kod:
    Private Declare Function OpenThread Lib "kernel32.dll" (ByVal dwDesiredAccess As ThreadAccess, ByVal bInheritHandle As Boolean, ByVal dwThreadId As UInteger) As IntPtr
    Private Declare Function SuspendThread Lib "kernel32.dll" (ByVal hThread As IntPtr) As UInteger
    Private Declare Function ResumeThread Lib "kernel32.dll" (ByVal hThread As IntPtr) As UInteger
    Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hHandle As IntPtr) As Boolean
    Public Enum ThreadAccess As Integer
        TERMINATE = (&H1)
        SUSPEND_RESUME = (&H2)
        GET_CONTEXT = (&H8)
        SET_CONTEXT = (&H10)
        SET_INFORMATION = (&H20)
        QUERY_INFORMATION = (&H40)
        SET_THREAD_TOKEN = (&H80)
        IMPERSONATE = (&H100)
        DIRECT_IMPERSONATION = (&H200)
    End Enum

Form da herhangi bir yerde kullanın ;

Kod:
 Private Sub SuspendProcess(ByVal process As System.Diagnostics.Process)
        For Each t As ProcessThread In process.Threads
            Dim th As IntPtr

            th = OpenThread(ThreadAccess.SUSPEND_RESUME, False, t.Id)
            If th <> IntPtr.Zero Then
                SuspendThread(th)
                CloseHandle(th)
            End If
        Next
    End Sub

    Private Sub ResumeProcess(ByVal process As System.Diagnostics.Process)
        For Each t As ProcessThread In process.Threads
            Dim th As IntPtr

            th = OpenThread(ThreadAccess.SUSPEND_RESUME, False, t.Id)
            If th <> IntPtr.Zero Then
                ResumeThread(th)
                CloseHandle(th)
            End If
        Next
    End Sub

Butonun İçine Yazılacak Kod (Durdur) ;

Kod:
Dim uygulama As Process() = Process.GetProcessesByName("Uygulama Adı")
        SuspendProcess(uygulama(0))

Butonun İçine Yazılacak Kod (Devam Ettir) ;

Kod:
Dim uygulama As Process() = Process.GetProcessesByName("Uygulama Adı")
        ResumeProcess(uygulama(0))
 
Uzman Üye
Katılım
8 Ocak 2020
Mesajlar
190
Tepki puanı
22
Yaş
32
6 HİZMET YILI
olm sen şakamısın ahahhaha benim başka bir forumdaki tüm konularımı burda paylaşmışsın gerçekten yazık .
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst