Does anyone know how to maximise an application that has been minimised to the taskbar.
The program is started using:
Shell("<program", bvnormalfocus)
so I have the PID so i can give the application focus, but it doesn't maximise.
Printable View
Does anyone know how to maximise an application that has been minimised to the taskbar.
The program is started using:
Shell("<program", bvnormalfocus)
so I have the PID so i can give the application focus, but it doesn't maximise.
Do you know the program?
Use the FindWindow api function to find the window's hwnd.Code:Declare Function ShowWindow Lib "User32" (ByVal Hwnd _
As Long, ByVal nCmdShow As Long) As Long
Public Const SW_MAXIMIZE = 3
maxi = ShowWindow(Hwnd, SW_MAXIMIZE)
Code:Private Declare Function FindWindow Lib "user32.dll" _
Alias "FindWindowA" (ByVal lpClassName As Any, ByVal _
lpWindowName As Any) As Long
h = FindWindow(vbNullString, "Window's caption")
If h <> 0 Then
maxi = ShowWindow(h, SW_MAXIMIZE)
Else
MsgBox "Window was not found!", 16
End If
Use the OpenIcon() function.
Code:Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function OpenIcon Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Command1_Click()
Dim hApp As Long
'Get the hWnd of the window
hApp = FindWindowEx(0, 0, "SciCalc", "Calculator")
'Restore the window
If hApp <> 0 Then OpenIcon hApp
End Sub