Hello, I am bringing to top the window of an external program (Microsoft Outlook) with the following code:
This works fine but I'd like to change the position and size of Outlook. How can this be done?
Thanks in advance.
Code:
Private Declare Function BringWindowToTop Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As Any, _
ByVal lpWindowName As Any) As Long
Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const SW_SHOWNORMAL = 1
Code:
Public Function WinToTop(WindowTitle As String)
Dim iret As Long, THandle As Long
THandle = FindWindow(vbEmpty, WindowTitle)
If THandle <> 0 Then
If IsIconic(THandle) > 0 Then
ShowWindow THandle, SW_SHOWNORMAL
Else
BringWindowToTop (THandle)
End If
End If
End Function
Code:
Private Sub Command104_Click()
WinToTop "Microsoft Outlook"
End Sub
This works fine but I'd like to change the position and size of Outlook. How can this be done?
Thanks in advance.