Hey everyone. I was looking for a good way to automatically disable images within the web browser component when I came across this code. The code seams to work great for disabling the images, but it doesn't seam to suppress script errors and it doesn't seam to hide scrollbars even if you set that option to True. Could someone look at the component code below and tell me why this might be? When looking under the "BrowserOptions" I see a suppresses option..As for the scrollbars, no idea why those do not work... Imports System.Runtime.InteropServices <ComVisible(True)> _ Public Class WebbrowserEx Inherits System.Windows.Forms.WebBrowser Implements IOleClientSite Private _options As BrowserOptions = BrowserOptions.None Private _IsInit As Boolean = False Public Property ShowImages() As Boolean Get Return Not (_options = (_options Or BrowserOptions.Images)) End Get Set(ByVal value As Boolean) If value Then _options = _options Or BrowserOptions.Images Else _options = _options And Not BrowserOptions.Images End If If Not Me.DesignMode Then If Me.ActiveXInstance Is Nothing Then Return Dim obj As IOleControl = DirectCast(Me.ActiveXInstance, IOleControl) 'notify browser of change obj.OnAmbientPropertyChange(-5512) Me.Navigate(Me.Url) 'While Me.ReadyState <> WebBrowserReadyState.Complete 'Application.DoEvents() 'End While Me._options = Me._options And Not BrowserOptions.Images obj.OnAmbientPropertyChange(-5512) End If End Set End Property Public Sub New() MyBase.New() End Sub Private Sub InitBrowser() Dim obj As IOleObject = CType(Me.ActiveXInstance, IOleObject) obj.SetClientSite(Me) End Sub <DispId(-5512)> _ Public Overridable Function IDispatch_Invoke_Handler() As Integer System.Diagnostics.Debug.WriteLine("-5512") Return CInt(_options) End Function Public Function GetContainer(ByRef container As Object) As Integer Implements IOleClientSite.GetContainer container = Me Return 0 End Function Public Function GetMoniker(ByVal dwAssign As Integer, ByVal dwWhichMoniker As Integer, ByRef moniker As Object) As Integer Implements IOleClientSite.GetMoniker moniker = Me Return 0 End Function Public Function OnShowWindow(ByVal fShow As Integer) As Integer Implements IOleClientSite.OnShowWindow Return 0 End Function Public Function RequestNewObjectLayout() As Integer Implements IOleClientSite.RequestNewObjectLayout Return 0 End Function Public Function SaveObject() As Integer Implements IOleClientSite.SaveObject Return 0 End Function Public Function ShowObject() As Integer Implements IOleClientSite.ShowObject Return 0 End Function Private Sub WebbrowserEx_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles Me.Navigating If _IsInit Then Return _IsInit = True InitBrowser() End Sub End Class #Region "COM Interfaces" <StructLayout(LayoutKind.Sequential)> _ Friend Structure RECT Public left As Integer Public top As Integer Public right As Integer Public bottom As Integer End Structure <Serializable(), StructLayout(LayoutKind.Sequential)> _ Public Structure MSG Public hwnd As IntPtr Public message As Integer Public wParam As IntPtr Public lParam As IntPtr Public time As Integer Public pt_x As Integer Public pt_y As Integer End Structure <ComVisible(True), Guid("0000011B-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _ Public Interface IOleContainer '<[return]: MarshalAs(UnmanagedType.I4)> _ <PreserveSig()> Function ParseDisplayName(<[In](), MarshalAs(UnmanagedType.[Interface])> ByVal pbc As Object, <[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal pszDisplayName As String, <Out(), MarshalAs(UnmanagedType.LPArray)> ByVal pchEaten As Integer(), <Out(), MarshalAs(UnmanagedType.LPArray)> ByVal ppmkOut As Object()) As Integer '<[return]: MarshalAs(UnmanagedType.I4)> _ <PreserveSig()> Function EnumObjects(<[In](), MarshalAs(UnmanagedType.U4)> ByVal grfFlags As UInteger, <Out(), MarshalAs(UnmanagedType.LPArray)> ByVal ppenum As Object()) As Integer <PreserveSig()> Function LockContainer(<[In](), MarshalAs(UnmanagedType.Bool)> ByVal fLock As Boolean) As Integer End Interface <ComVisible(True), Guid("00000118-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ Public Interface IOleClientSite <PreserveSig()> Function SaveObject() As Integer <PreserveSig()> Function GetMoniker(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwAssign As Integer, <[In](), MarshalAs(UnmanagedType.U4)> ByVal dwWhichMoniker As Integer, <MarshalAs(UnmanagedType.[Interface])> ByRef moniker As Object) As Integer <PreserveSig()> Function GetContainer(ByRef container As Object) As Integer <PreserveSig()> Function ShowObject() As Integer <PreserveSig()> Function OnShowWindow(ByVal fShow As Integer) As Integer <PreserveSig()> Function RequestNewObjectLayout() As Integer End Interface <ComImport(), Guid("B196B288-BAB4-101A-B69C-00AA00341D07"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ Public Interface IOleControl <PreserveSig()> Function GetControlInfo(<Out()> ByVal pCI As Object) As Integer <PreserveSig()> Function OnMnemonic(<[In]()> ByRef pMsg As MSG) As Integer <PreserveSig()> Function OnAmbientPropertyChange(ByVal dispID As Integer) As Integer <PreserveSig()> Function FreezeEvents(ByVal bFreeze As Integer) As Integer End Interface <ComVisible(True), ComImport(), Guid("00000112-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _ Friend Interface IOleObject <PreserveSig()> Function SetClientSite(<[In](), MarshalAs(UnmanagedType.[Interface])> ByVal pClientSite As IOleClientSite) As Integer <PreserveSig()> Function GetClientSite(<Out(), MarshalAs(UnmanagedType.[Interface])> ByRef site As IOleClientSite) As Integer <PreserveSig()> Function SetHostNames(<[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal szContainerApp As String, <[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal szContainerObj As String) As Integer <PreserveSig()> Function Close(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwSaveOption As UInteger) As Integer <PreserveSig()> Function SetMoniker(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwWhichMoniker As UInteger, <[In](), MarshalAs(UnmanagedType.[Interface])> ByVal pmk As Object) As Integer <PreserveSig()> Function GetMoniker(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwAssign As UInteger, <[In](), MarshalAs(UnmanagedType.U4)> ByVal dwWhichMoniker As UInteger, <Out(), MarshalAs(UnmanagedType.[Interface])> ByRef moniker As Object) As Integer <PreserveSig()> Function InitFromData(<[In](), MarshalAs(UnmanagedType.[Interface])> ByVal pDataObject As Object, <[In](), MarshalAs(UnmanagedType.Bool)> ByVal fCreation As Boolean, <[In](), MarshalAs(UnmanagedType.U4)> ByVal dwReserved As UInteger) As Integer Function GetClipboardData(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwReserved As UInteger, ByRef data As Object) As Integer <PreserveSig()> Function DoVerb(<[In](), MarshalAs(UnmanagedType.I4)> ByVal iVerb As Integer, <[In]()> ByVal lpmsg As IntPtr, <[In](), MarshalAs(UnmanagedType.[Interface])> ByVal pActiveSite As IOleClientSite, <[In](), MarshalAs(UnmanagedType.I4)> ByVal lindex As Integer, <[In]()> ByVal hwndParent As IntPtr, <[In]()> ByVal lprcPosRect As RECT) As Integer <PreserveSig()> Function EnumVerbs(ByRef e As Object) As Integer <PreserveSig()> Function OleUpdate() As Integer <PreserveSig()> Function IsUpToDate() As Integer '<[return]: MarshalAs(UnmanagedType.I4)> _ <PreserveSig()> Function GetUserClassID(<[In](), Out()> ByRef pClsid As Guid) As Integer '<[return]: MarshalAs(UnmanagedType.I4)> _ <PreserveSig()> Function GetUserType(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwFormOfType As UInteger, <Out(), MarshalAs(UnmanagedType.LPWStr)> ByRef userType As String) As Integer <PreserveSig()> Function SetExtent(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwDrawAspect As UInteger, <[In]()> ByVal pSizel As Object) As Integer <PreserveSig()> Function GetExtent(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwDrawAspect As UInteger, <Out()> ByVal pSizel As Object) As Integer <PreserveSig()> Function Advise(<[In](), MarshalAs(UnmanagedType.[Interface])> ByVal pAdvSink As System.Runtime.InteropServices.ComTypes.IAdviseSink, ByRef cookie As Integer) As Integer <PreserveSig()> Function Unadvise(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwConnection As Integer) As Integer <PreserveSig()> Function EnumAdvise(ByRef e As Object) As Integer <PreserveSig()> Function GetMiscStatus(<[In](), MarshalAs(UnmanagedType.U4)> ByVal dwAspect As UInteger, ByRef misc As Integer) As Integer <PreserveSig()> Function SetColorScheme(<[In]()> ByVal pLogpal As Object) As Integer End Interface Public Enum BrowserOptions As UInteger ''' <summary> ''' No flags are set. ''' </summary> None = 0 ''' <summary> ''' The browser will operate in offline mode. Equivalent to DLCTL_FORCEOFFLINE. ''' </summary> AlwaysOffline = 268435456 ''' <summary> ''' The browser will play background sounds. Equivalent to DLCTL_BGSOUNDS. ''' </summary> BackgroundSounds = 64 ''' <summary> ''' Specifies that the browser will not run Active-X controls. Use this setting ''' to disable Flash movies. Equivalent to DLCTL_NO_RUNACTIVEXCTLS. ''' </summary> DontRunActiveX = 512 ''' <summary> ''' Specifies that the browser should fetch the content from the server. If the server's ''' content is the same as the cache, the cache is used.Equivalent to DLCTL_RESYNCHRONIZE. ''' </summary> IgnoreCache = 8192 ''' <summary> ''' The browser will force the request from the server, and ignore the proxy, even if the ''' proxy indicates the content is up to date.Equivalent to DLCTL_PRAGMA_NO_CACHE. ''' </summary> IgnoreProxy = 16384 ''' <summary> ''' Specifies that the browser should download and display images. This is set by default. ''' Equivalent to DLCTL_DLIMAGES. ''' </summary> Images = 16 ''' <summary> ''' Disables downloading and installing of Active-X controls.Equivalent to DLCTL_NO_DLACTIVEXCTLS. ''' </summary> NoActiveXDownload = 1024 ''' <summary> ''' Disables web behaviours.Equivalent to DLCTL_NO_BEHAVIORS. ''' </summary> NoBehaviours = 32768 ''' <summary> ''' The browser suppresses any HTML charset specified.Equivalent to DLCTL_NO_METACHARSET. ''' </summary> NoCharSets = 65536 ''' <summary> ''' Indicates the browser will ignore client pulls.Equivalent to DLCTL_NO_CLIENTPULL. ''' </summary> NoClientPull = 536870912 ''' <summary> ''' The browser will not download or display Java applets.Equivalent to DLCTL_NO_JAVA. ''' </summary> NoJava = 256 ''' <summary> ''' The browser will download framesets and parse them, but will not download the frames ''' contained inside those framesets.Equivalent to DLCTL_NO_FRAMEDOWNLOAD. ''' </summary> NoFrameDownload = 524288 ''' <summary> ''' The browser will not execute any scripts.Equivalent to DLCTL_NO_SCRIPTS. ''' </summary> NoScripts = 128 ''' <summary> ''' If the browser cannot detect any internet connection, this causes it to default to ''' offline mode.Equivalent to DLCTL_OFFLINEIFNOTCONNECTED. ''' </summary> OfflineIfNotConnected = 2147483648 ''' <summary> ''' Specifies that UTF8 should be used.Equivalent to DLCTL_URL_ENCODING_ENABLE_UTF8. ''' </summary> UTF8 = 262144 ''' <summary> ''' The browser will download and display video media.Equivalent to DLCTL_VIDEOS. ''' </summary> Videos = 32 End Enum #End Region Code (markup):