Edit

Share via


WindowObject Interface

Definition

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

public interface class WindowObject : Microsoft::Office::Interop::InfoPath::Window2
[System.Runtime.InteropServices.Guid("096CD5F7-0786-11D1-95FA-0080C78EE3BB")]
public interface WindowObject : Microsoft.Office.Interop.InfoPath.Window2
type WindowObject = interface
    interface Window2
Public Interface WindowObject
Implements Window2
Derived
Attributes
Implements

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.

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[Object] 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.

Properties

Active

Gets a value that indicates whether the window associated with the WindowObject object is the active window.

(Inherited from Window2)
Caption

Gets or sets the caption text for the window represented by the WindowObject object.

(Inherited from Window2)
CommandBars

Gets a reference to the Microsoft Office CommandBars collection contained in the window that is associated with the WindowObject object.

(Inherited from Window2)
Height

Gets or sets the height of the window represented by the WindowObject object, measured in points.

(Inherited from Window2)
Left

Gets or sets the horizontal position of the window represented by the WindowObject object, measured in points.

(Inherited from Window2)
MailEnvelope

Gets a reference to the MailEnvelopeObject object associated with the window that is represented by the WindowObject object.

(Inherited from Window2)
TaskPanes

Gets a reference to the TaskPanesCollection collection that is associated with the WindowObject object.

(Inherited from Window2)
Top

Gets or sets the vertical position of the window represented by the WindowObject object, measured in points.

(Inherited from Window2)
Width

Gets or sets the width of the window represented by the WindowObject object, measured in points.

(Inherited from Window2)
WindowState

Gets or sets the state of the window represented by the WindowObject object.

(Inherited from Window2)
WindowType

Gets an XdWindowType value that indicates the type of window that is represented by the WindowObject object.

(Inherited from Window2)
XDocument

Gets a reference to the XDocument object that is associated with the window that is represented by the WindowObject object.

(Inherited from Window2)

Methods

Activate()

Activates the window that is represented by the WindowObject object.

(Inherited from Window2)
Close(Boolean)

Closes the window that is represented by the WindowObject object.

(Inherited from Window2)

Applies to