Export (0) Print
Expand All

HtmlTaskPane.HtmlWindow property

Gets a reference to the MSHTML IHTMLWindow2 interface for working with the HTML document of a custom task pane.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

'Declaration
Public MustOverride ReadOnly Property HtmlWindow As Object
	Get
'Usage
Dim instance As HtmlTaskPane
Dim value As Object

value = instance.HtmlWindow

Property value

Type: System.Object
An IHTMLWindow2 object associated with HTML file of the custom task pane.

ExceptionCondition
SecurityException

The form template is not configured for Full Trust using the Security and Trust category of the Form Options dialog box.

Using the HtmlWindow property, you can call scripting functions contained in the HTML code of the task pane from the primary form code, manipulate the HTML code of the task pane, and work with any of the properties and methods that the IHTMLWindow2 interface provides.

NoteNote

The HtmlWindow property provides the same functionality as the HtmlDocument property, but it is only available when using fully trusted forms. If the form is not fully trusted, you can use the HtmlDocument property instead.

This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.

This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.

In the following example, the HtmlWindow property of the HtmlTaskPane class is used to set a reference to the IHTMLWindow2 object of the custom task pane of a fully trusted form. Then the code calls the TaskPaneSwitchView custom function that is defined in the HTML code of the custom task pane.

   ' Get a reference to the custom task pane. It is always index (0)
   ' in the TaskPanes collection.
   Dim custom As HtmlTaskPane = _
      DirectCast(Me.CurrentView.Window.TaskPanes(0), _
      Microsoft.Office.InfoPath.HtmlTaskPane)

     ' Get a reference to the parent window of the task pane.
      Dim window As IHTMLWindow2 = DirectCast(custom.HtmlWindow, _
         IHTMLWindow2

     ' Call into script through CLR late binding mechanism.
     window.GetType().InvokeMember( _
      "TaskPaneSwitchView", _
      System.Reflection.BindingFlags.InvokeMethod Or _
      System.Reflection.BindingFlags.DeclaredOnly Or _
      System.Reflection.BindingFlags.Public Or _
      System.Reflection.BindingFlags.Instance, _
      Nothing, _
      window, _
      Nothing)
Show:
© 2014 Microsoft