How to Minimize, Maximize External Running Program through my VB.Net Application

  • Thread starter Ramkishan Algude via DotNetMonster.com
  • Start date
R

Ramkishan Algude via DotNetMonster.com

I am New Member on this site. And also new learner to .Net.
I have a query, I have to minimize/maximize the currently running some
applications on my system through my VB.Net application.

Please can any one help me..!!!
 
C

Crouchie1998

If you want the current application minimized/maximized then do this:

Me.WindowState = FormWindowState.Maximized
Me.WindowState = FormWindowState.Minimized


Crouchie1998
BA (HONS) MCP MCSE
 
H

Herfried K. Wagner [MVP]

Ramkishan Algude via DotNetMonster.com said:
I have a query, I have to minimize/maximize the currently running some
applications on my system through my VB.Net application.


P/invoke with 'ShowWindow':

\\\
Imports System.Diagnostics
..
..
..
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

Private Sub MaximizeAllNotepads()
For Each p As Process In Process.GetProcessesByName("notepad")
ShowWindow(p.MainWindowHandle, SHOW_WINDOW.SW_MAXIMIZE)
Next p
End Sub
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top