Gets a reference to an HTML window object of the Microsoft InfoPath custom task pane.
Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)
The HTMLWindow property of the HTMLTaskPaneObject object is one of the properties inherited by the TaskPaneObject object when the type of the task pane is 0, which means that it is the custom task pane.
Using the HTMLWindow property, you can call scripting functions contained in the HTML code of the task pane from the primary form code, and you can also directly manipulate the HTML code of the task pane using any of the properties and methods that the HTML document object provides.
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.
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.
In the following example, the HTMLWindow property of the HTMLTaskPaneObject object is used to set a reference to the HTML window 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.
HTMLTaskPane custom = (HTMLTaskPane) thisXDocument.View.Window.TaskPanes; mshtml.IHTMLWindow2 window = custom.HTMLWindow; // call into script through CLR late binding mechanism window.GetType().InvokeMember( "TaskPaneSwitchView", // late bound method System.Reflection.BindingFlags.InvokeMethod | // binding flags System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, null, // binder object window, // target object null);