|
-
July 9th, 2008, 12:51 AM
#2
Re: Resize 3rd Party Application
To Minimize an external application, you simply need to use the ShowWindow API. Have a look at this example :
Code:
Imports System.Runtime.InteropServices 'used with APIs
Public Class Form1
Private Const SW_SHOWMINIMIZED As Int32 = 2 'Minimize constant
<DllImport("user32.dll", EntryPoint:="ShowWindow", CharSet:=CharSet.Auto)> _
Private Shared Function ShowWindow(ByVal hwnd As Int32, ByVal nCmdShow As Int32) As Int32
End Function 'ShowWindow API
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim NoteProc() As Process = Process.GetProcessesByName("notepad") 'Get Notepad's handle
If NoteProc.Length > 0 Then ShowWindow(NoteProc(0).MainWindowHandle, SW_SHOWMINIMIZED) 'Minimize
End Sub
End Class
So, all you'd need to do is to replace Notepad with the EXE name of your external application.
To Maximize an external window, you can follow the exact same method as outlined above; obviously, you'd need to use the SW_SHOWMAXIMIZED constant, and optionally, you could use the SetForegroundWindow API to bring the external application to the front.
Try this part first, then, we can look at resizing external windows 
I hope my post was useful
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|