How do I resize an external application like firefox in VB.net?

vaultworld
vaultworld used Ask the Experts™
on
How do I resize an external application like firefox in VB.net?  

I would like to force the size to 800 by 800 or something similar.

I think i would get the handle but where do i go from there?
       
  Dim ps() As Process = Process.GetProcessesByName(firefox)

            If ps.Length > 0 Then
                Dim p As Process = ps(0)
                Dim hWnd As IntPtr = p.MainWindowHandle
                SetForegroundWindow(hWnd)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
Commented:
Use the SetWindowPos() API:

    Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer

    ...
        SetWindowPos(hWnd, IntPtr.Zero, 0, 0, 800, 800, 0)

Author

Commented:
Idle Mind - Is a genious

Author

Commented:
One more thing that will be helpful is Flags

Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40

SetWindowPos(hWnd, IntPtr.Zero, 0, 0, 800, 800, FLAGS)

Also genius is this way.  ;)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial