Hi guys :wave:
I'm running a process using the Process class. My question is, how can we minimize the process while it is running ?:confused:
Thanks :wave:
Printable View
Hi guys :wave:
I'm running a process using the Process class. My question is, how can we minimize the process while it is running ?:confused:
Thanks :wave:
I think, I found the solution. :D
It's using API. But is there any inbuilt functions/subs available for this ? :confused:vb.net Code:
Imports System.Diagnostics Public Class Form1 #Region "API Code" Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal nCmdShow As SHOW_WINDOW) As Boolean <Flags()> _ Private Enum SHOW_WINDOW As Integer SW_HIDE = 0 SW_SHOWNORMAL = 1 SW_NORMAL = 1 SW_SHOWMINIMIZED = 2 SW_SHOWMAXIMIZED = 3 SW_MAXIMIZE = 3 SW_SHOWNOACTIVATE = 4 SW_SHOW = 5 SW_MINIMIZE = 6 SW_SHOWMINNOACTIVE = 7 SW_SHOWNA = 8 SW_RESTORE = 9 SW_SHOWDEFAULT = 10 SW_FORCEMINIMIZE = 11 SW_MAX = 11 End Enum #End Region '~~~ Variable that holds the Process object Dim myProc As Process '~~~ Start the process Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click myProc = Process.Start("notepad") End Sub '~~~ Minimize the process Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ShowWindow(myProc.MainWindowHandle, SHOW_WINDOW.SW_MINIMIZE) End Sub End Class
:wave:
API is your only option because all you've got is a window handle, not a .NET Form object.
Thanks :wave: