[RESOLVED] [2008] Hide IE7 Webbrowser
I'm having difficulty figuring out hiding IE 7 window in VB.net
and want to know if anyone knows how to do it correctly?
I have an automation tool that uses the web browser and steals
focus of any open windows, I thought of trying to hide the browser
but I can't find anything on that using the search feature.
Anyone have an idea?
Chris
Re: [2008] Hide IE7 Webbrowser
This hides the windows, use 'ShowWindow(handle, SW_SHOW)' to show the windows again:
Declarations:
Code:
<Runtime.InteropServices.DllImport("USER32.DLL")> _
Public Shared Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As UInteger) As Boolean
End Function
Public Const SW_HIDE As Integer = &H0
Public Const SW_SHOWNORMAL As Integer = &H1
Public Const SW_SHOWMINIMIZED As Integer = &H2
Public Const SW_SHOWMAXIMIZED As Integer = &H3
Public Const SW_SHOWNOACTIVATE As Integer = &H4
Public Const SW_SHOW As Integer = &H5
Public Const SW_MINIMIZE As Integer = &H6
Public Const SW_SHOWMINNOACTIVATE As Integer = &H7
Public Const SW_SHOWNA As Integer = &H8
Public Const SW_RESTORE As Integer = &H9
Private handle As IntPtr
Form Load or Timer Tick etc..:
Code:
For Each p As Process In Process.GetProcesses
If p.MainWindowTitle.Contains("Internet Explorer") Then
handle = p.MainWindowHandle
ShowWindow(handle, SW_HIDE)
End If
Next
Re: [2008] Hide IE7 Webbrowser
Thanks my friend :)
Just rated you!
Chris