WindowsCollection Interface

Definition

Contains a WindowObject object for each Microsoft InfoPath window that is currently open.

public interface class WindowsCollection : Microsoft::Office::Interop::InfoPath::SemiTrust::Windows
[System.Runtime.InteropServices.Guid("096cd58b-0786-11d1-95fa-0080c78ee3bb")]
public interface WindowsCollection : Microsoft.Office.Interop.InfoPath.SemiTrust.Windows
type WindowsCollection = interface
    interface Windows
Public Interface WindowsCollection
Implements Windows
Attributes
Implements

Examples

In the following example, implemented as an OnClick event handler for a button on a form, the Windows property of the Application object is used to set a reference to the WindowsCollection collection. The code then loops through the collection and displays the type of each Window object that it contains.

[InfoPathEventHandler(MatchPath="ShowWindowTypes", EventType=InfoPathEventType.OnClick)]
public void ShowWindowTypes_OnClick(DocActionEvent e)
{
// Set a reference to the Windows collection.
<span class="label">WindowsCollection</span> windows = thisApplication.Windows;

// Loop through the collection and display the type
// of each Window object that it contains.
for (int i=0; i &lt; windows.Count; i++)
 {
string windowType = "";

switch (windows[i].WindowType)
    {
    case XdWindowType.xdEditorWindow:
    windowType = "Editing window";
    break;

    case XdWindowType.xdDesignerWindow:
    windowType = "Designing window";
    break;
    }

thisXDocument.UI.Alert("Window type " + i + ": " + windowType);
 }
}

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, seeWindows.

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 WindowsCollection collection implements properties that can be used to access a form's associated Window objects, and it is accessible through the Windows property of the Application object.

Note: The WindowsCollection collection can be used only to get the count of WindowObject objects that it contains or to return a reference to a specified WindowObject object. It cannot be used to create, add, or remove WindowObject objects.

Properties

Count

Gets a count of the number of WindowObject objects contained in the WindowsCollection collection.

(Inherited from Windows)
Item[Object]

Gets a reference to the specified WindowObject object from WindowsCollection collection.

(Inherited from Windows)

Methods

GetEnumerator()

Gets an IEnumerator that iterates over all entries in the WindowsCollection object.

(Inherited from Windows)

Applies to