HTMLTaskPane.HTMLWindow property
Gets a reference to an HTML window object of the Microsoft Office InfoPath 2003 custom task pane.
Namespace: Microsoft.Office.Interop.InfoPath
Assembly: Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)
Syntax
'Declaration
ReadOnly Property HTMLWindow As IHTMLWindow2
Get
'Usage
Dim instance As HTMLTaskPane
Dim value As IHTMLWindow2
value = instance.HTMLWindow
IHTMLWindow2 HTMLWindow { get; }
Property value
Type: IHTMLWindow2
Remarks
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.
Note
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.
Examples
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[0];
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);