編輯

共用方式為


HTMLTaskPane.HTMLWindow Property

Definition

Gets a reference to an HTML window object of the Microsoft Office InfoPath 2003 custom task pane.

public:
 property mshtml::IHTMLWindow2 ^ HTMLWindow { mshtml::IHTMLWindow2 ^ get(); };
public mshtml.IHTMLWindow2 HTMLWindow { get; }
member this.HTMLWindow : mshtml.IHTMLWindow2
Public ReadOnly Property HTMLWindow As IHTMLWindow2

Property Value

mshtml.IHTMLWindow2

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.<span class="label">HTMLWindow</span>;
// 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);

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.

Applies to