wpQueryOpenFolders
This method is specific to Version 4, or higher, of the OS/2 operating system.
This instance method allows for the enumeration of all open folders in the system.
Syntax
_wpQueryOpenFolders(somSelf, ulOption)
Parameters
- somSelf (WPFolder *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPFolder.
- ulOption (ULONG) - input
- Flag indicating the type of operation.
- **QC_FIRST** Returns the first item in the open folder list.
- **QC_NEXT** Returns the next item in the open folder list.
Returns
- Object (WPObject *) - returns
- Pointer to an open folder object.
How to Override
This method is generally not be overridden.
Usage
You can call the **wpQueryOpenFolders** method in a loop to enumerate all open folders in the system.
Remarks
OS/2 maintains a list of all open folders in the system. **wpQueryOpenFolders** provides access to this list.
The first time you call **wpQueryOpenFolders** specify **QC_FIRST** in *ulOption*. A pointer to the first open folder in the open folder list is returned in *Object*. On subsequent calls specify **QC_NEXT** in *ulOption* and the pointer to the previously returned folder in *Object*. A pointer to the next folder in the open folder list is returned. **wpQueryOpenFolders** returns **NULL** after the last folder in the list has been returned.
- wpQueryOpenFolders** returns the next open folder after the folder passed in *Object*, or a **NULL** if the folder passed in *Object* is the last folder in the open folder list.
If **wpQueryOpenFolders** is called with **QC_NEXT** in *ulOption* and a pointer to a closed folder in *Object* then a **QC_FIRST** operation is performed.
> **Note:** Do not close the open views of a folder returned by the **wpQueryOpenFolders** method because this breaks the chain of open folders. If you close the last open view of a folder, the next call to **wpQueryOpenFolders** will return **NULL**, even though there are other open folders in the system.
Example Code
#define INCL_WINWORKPLACE
#include <os2.h>
WPFolder *somSelf; /* Pointer to the object on which the method is being invoked. */
ULONG ulOption; /* Flag indicating the type of operation. */
WPObject *Object; /* Pointer to an open folder object. */
Object = _wpQueryOpenFolders(somSelf, ulOption);
/* Example code provided in the source: */
WPFolder *Folder;
/* Find the first open folder */
Folder = _wpQueryOpenFolders(somSelf,QC_FIRST);
while (Folder)
{
/***** Code to process the folder goes here *****/
/* Find the next open folder */
Folder = _wpQueryOpenFolders(Folder,QC_NEXT);
}