The VB.Net code posted on this page minimizes the window for the given process name.
- Module modMain
- #Region "Declarations for Minimizing Windows"
- Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal nCmdShow As SHOW_WINDOW) As Boolean
- 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
- Sub Main()
- 'How to call this function
- MinimizeWindows("acrobat") 'This will minimize the acrobat application
- End Sub
- Public Sub MinimizeWindows(ByVal sProcessName As String)
- Dim p As Process
- For Each p In Process.GetProcessesByName(sProcessName)
- ShowWindow(p.MainWindowHandle, SHOW_WINDOW.SW_MINIMIZE)
- Next p
- End Sub
- End Module
Nice...
ReplyDeleteSurinder Singh
Website Designing