Share via


WindowObject interface

Represents a window that is used in the Microsoft Office InfoPath 2003 application.

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

Syntax

'Declaration
<GuidAttribute("096CD5F7-0786-11D1-95FA-0080C78EE3BB")> _
Public Interface WindowObject _
    Inherits Window2
'Usage
Dim instance As WindowObject
[GuidAttribute("096CD5F7-0786-11D1-95FA-0080C78EE3BB")]
public interface WindowObject : Window2

Remarks

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeWindow2.

The WindowObject objects represent the two types of windows that are used in the InfoPath application: the editing window that is used as the form area when a user fills out a form, and the designing window that is used as the design mode when a user designs a form.

The WindowObject object provides a number of properties and methods that can be used to programmatically interact with InfoPath windows, including the ability to activate or close a window and the ability to interact with the task panes and command bars that they contain. The WindowObject object also provides a property for accessing the form's underlying XML document that is associated with the window.

The WindowObject objects of an InfoPath form are accessed through the Item property. The type of window can be determined by using the WindowType property.

You can access the currently open window directly by using the ActiveWindow property of the Application object, without going through the WindowsCollection collection. You can also access the WindowObject object that is associated with a view by using the Window property.

Note

Some properties of the WindowObject object are only available when using the editing window type; they will return an error if used with the designing window type.

Examples

In the following example, implemented as an OnClick event handler for a button control, the ActiveWindow property is used to set a reference to the current window. Then the code checks the window type; if it is the editing window type, it displays the number of task panes contained in the window in a message box.

public void WindowObject_OnClick(DocActionEvent e)
{
 Window2 activeWindow;
   
 // Set a reference to the current window.
 activeWindow = thisApplication.ActiveWindow;
 
 // Check that the window is an editing window type.
 if (activeWindow.WindowType == XdWindowType.xdEditorWindow)
 {
  // Display the number of task panes in the window.
  thisXDocument.UI.Alert("Number of task panes: " + 
   activeWindow.TaskPanes.Count);
 }
}

For code examples, see How to: Work with Form Windows Using the InfoPath 2003 Object Model.

See also

Reference

WindowObject members

Microsoft.Office.Interop.InfoPath namespace