Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I did time ago a snippet which works with any proccess, are two generic functions and also has recursive mode and is easy to use:</p> <pre><code>#Region " Hide-Restore Process " ' [ Hide-Restore Process Function ] ' ' // By Elektro H@cker ' ' Examples : ' ' Hide_Process(Process.GetCurrentProcess().MainModule.ModuleName, False) ' Hide_Process("notepad.exe", False) ' Hide_Process("notepad", True) ' ' Restore_Process(Process.GetCurrentProcess().MainModule.ModuleName, False) ' Restore_Process("notepad.exe", False) ' Restore_Process("notepad", True) Dim Process_Handle_Dictionary As New Dictionary(Of String, IntPtr) &lt;System.Runtime.InteropServices.DllImport("User32")&gt; Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Int32 End Function Private Sub Hide_Process(ByVal Process_Name As String, Optional ByVal Recursive As Boolean = False) If Process_Name.ToLower.EndsWith(".exe") Then Process_Name = Process_Name.Substring(0, Process_Name.Length - 4) Dim proc() As Process = Process.GetProcessesByName(Process_Name) If Recursive Then For proc_num As Integer = 0 To proc.Length - 1 Try Process_Handle_Dictionary.Add(Process_Name &amp; ";" &amp; proc(proc_num).Handle.ToString, proc(proc_num).MainWindowHandle) ShowWindow(proc(proc_num).MainWindowHandle, 0) Catch ex As Exception ' MsgBox(ex.Message) ' The handle already exist in the Dictionary End Try Application.DoEvents() Next Else If Not proc.Length = 0 AndAlso Not proc(0).MainWindowHandle = 0 Then Process_Handle_Dictionary.Add(Process_Name &amp; ";" &amp; proc(0).Handle.ToString, proc(0).MainWindowHandle) ShowWindow(proc(0).MainWindowHandle, 0) End If End If End Sub Private Sub Restore_Process(ByVal Process_Name As String, Optional ByVal Recursive As Boolean = False) If Process_Name.ToLower.EndsWith(".exe") Then Process_Name = Process_Name.Substring(0, Process_Name.Length - 4) Dim Temp_Dictionary As New Dictionary(Of String, IntPtr) ' Replic of the "Process_Handle_Dictionary" dictionary For Each Process In Process_Handle_Dictionary : Temp_Dictionary.Add(Process.Key, Process.Value) : Next If Recursive Then For Each Process In Temp_Dictionary If Process.Key.ToLower.Contains(Process_Name.ToLower) Then ShowWindow(Process.Value, 9) Process_Handle_Dictionary.Remove(Process.Key) End If Application.DoEvents() Next Else For Each Process In Temp_Dictionary If Process.Key.ToLower.Contains(Process_Name.ToLower) Then ShowWindow(Process.Value, 9) Process_Handle_Dictionary.Remove(Process.Key) Exit For End If Application.DoEvents() Next End If End Sub #End Region </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload