WindowsCollection interface

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

Namespace:  Microsoft.Office.Interop.InfoPath
Assembly:  Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.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 COM interface implemented by a coclass that is required by managed code for COM interoperability. To access the members specified by this interface, use the type that wraps the coclass that implements this interface. For information about that type, including usage, remarks, and examples, 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.

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.

See also

Reference

WindowsCollection members

Microsoft.Office.Interop.InfoPath namespace