There are several ways to do this, but here’s one of the easiest.
Above all, refer to this namespace:
Imports System.Runtime.InteropServices
Now declare that 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 occult, if it’s 1, she will be showoff.
You don’t need to tag
visual-studiowhen the problem is unrelated to the IDE. See this question for more details.– Jéf Bueno
Explain better what you intend to do? Hide a third-party application? Or open your application "minimized"?
– Jéf Bueno
hide third party application, not only minimize too, I know how to open hidden, but do not know hide when already opened .
– Wladi Veras