Imports System.Runtime.InteropServices Public Class Form1 Const SW_HIDE As Integer = 0 Const SW_SHOW As Integer = 1 Dim process As Process <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Private Shared Function ShowWindow(ByVal hwnd As IntPtr, nCmdShow As Integer) As Boolean End Function 'Button for Hide process Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click ShowWindow(process.MainWindowHandle, SW_HIDE) End Sub 'Button for Show process Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click ShowWindow(process.MainWindowHandle, SW_SHOW) End Sub Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim psi As ProcessStartInfo = New ProcessStartInfo() psi.FileName = "Calc.exe" TextBox1.Text = "Start calculator" process.Start(psi) 'Wait until the process has a main window handle. While process.MainWindowHandle = IntPtr.Zero process.Refresh() End While End Sub End Class
process.Start(psi)
process.StartInfo = psi process.Start()
process = process.Start(psi)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)