ClientToHostWindow Event

Fires to request that the client window size is converted to the host window size.

Syntax

  Private Sub object_ClientToHostWindow( _
  ByRef CX As Long, _
  ByRef CY As Long)

Parameters

  • object
    Object expression that resolves to the WebBrowser object.
  • CX
    Long integer that receives the width of the client window and can be set by the host application.
  • CY
    Long integer that receives the height of the client window and can be set by the host application.

Error Codes

No return value.

Remarks

The ClientToHostWindow event enables the host application to adjust the size of the WebBrowser control window that allows for user interface items such as a toolbar, menu bar, or address bar.

This event is fired when a new window is opened through scripting, using the open method.

The following example indicates how the ClientToHostWindow event can be handled.

Private Sub WebBrowser1_ClientToHostWindow(CX As Long, CY As Long)
    If (bToolbarVisible) Then
        CY = CY + iToolbarHeight
    End If
    If (bStatusbarVisible) Then
        CY = CY + iStatusbarHeight
    End If
End Sub

This event is available only to an application that is hosting the WebBrowser control installed by Microsoft Internet Explorer 5.5 and later.

Applies To

WebBrowser