There are several ways to do this, but here's one of the easiest ones.
Mainly, refer to this namespace:
Imports System.Runtime.InteropServices
Now declare this function.
<DllImport("user32.dll")> _
Private Shared Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Boolean
End Function
And use this method to display or hide something.
Public Sub AlterarStatus(ByVal NomeDoProcesso$, ByVal Status As Integer)
Dim mywindow As Integer
Dim processRunning As Process() = Process.GetProcesses()
For Each pr As Process In processRunning
' Uso do ToLower() para ignorar maiúsculas de minúsculas, se não quiser isso, remova
' nos dois membros
If pr.ProcessName.ToLower() = NomeDoProcesso.ToLower() Then
mywindow = pr.MainWindowHandle.ToInt32()
ShowWindow(mywindow , Status)
End If
Next
End Sub
In the argument Status
, if its value is 0 , the window will be hidden , if it is 1 displayed .