Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximize another application

Status
Not open for further replies.

cjelec

Programmer
Jan 5, 2007
491
GB
VB.net 2003 .net 1.1

Hi,

I know that this may be a stupidly easy one, but:

How do I maximize another applications window?

I am starting an application with the Process class in minimize, and at a given point I need to maximize it.

Is there a way to send a maximize command using the handle?
Is there a global (standard) key combination to maximize a window?

AppActivate(...) doesn't really do anything.

Thanks in advance for any help
 
As follows:

Public Const SW_RESTORE As Integer = 9

Public Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer

Public hwnd As Integer

In your code to maximize do:

ShowWindow(hwnd, SW_RESTORE)

~CIAO~
 
Thanks for you reply,

I remember now.
I used to do this with vb6.

Just need to find the code for finding a windows hwnd.

Thanks again
 
Use

Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer

or

dim hwnd as integer
Dim localname as Process() = Process.GetProcessesByName("processname")
hwnd = CType(localname(0).MainWindowHandle, Integer)

CIAO
 

I'll give it a try after I fix another problem (BitBlt'ing a window to a form at 10-30fps, works but is a huge resource hogger)

Thanks again,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top