WindowsCollection interface

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

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

Syntax

'Declaration
<GuidAttribute("096cd58b-0786-11d1-95fa-0080c78ee3bb")> _
Public Interface WindowsCollection _
    Inherits Windows
'Usage
Dim instance As WindowsCollection
[GuidAttribute("096cd58b-0786-11d1-95fa-0080c78ee3bb")]
public interface WindowsCollection : Windows

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.

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.
WindowsCollection windows = thisApplication.Windows;

// Loop through the collection and display the type
// of each Window object that it contains.
for (int i=0; i < 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.

See also

Reference

WindowsCollection members

Microsoft.Office.Interop.InfoPath.SemiTrust namespace