wpclsFindObjectEnd
Appearance
This class method is called to end the find operation started by a call to the wpclsFindObjectFirst method.
Syntax
_wpclsFindObjectEnd(somSelf, hfind)
Parameters
- somSelf (M_WPObject *) - input
- Pointer to the WPObject class object.
- hfind (HFIND) - input
- Handle associated with a previous wpclsFindObjectFirst or wpclsFindObjectNext method call.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion.
- FALSE
- Error occurred.
Remarks
This method should be called to terminate a find operation that was started by a previous call to the wpclsFindObjectFirst method.
How to Override
This method is generally not overridden.
Usage
This method should be called to terminate a find operation that was started by a previous call to the wpclsFindObjectFirst method.
Example Code
This example finds all occurrences of an object type in a folder.
#define INCL_WINWORKPLACE #include <os2.png> VOID clsFindEverybody(SOMAny *self) { BOOL rc; /* Return from methods */ HFIND hFind = 0; /* Handle for repeated finds */ CLASS Class[2]; /* List of classes to look for */ OBJECT Object[10]; /* Objects returned from search */ ULONG ulCount = 10; /* Count of objects to find / or found */ WPFolder *folder = 0; /* Pointer to folder for search */ ULONG errorid = 0; /* Error returned from previous search */ CHAR sz[CCHMAXPATH]; /* Title string to look for */ PSZ title = sz; Class[0] = _WPFolder; Class[1] = NULL; /* Get the pointer to the desktop (since that is where we are looking) */ folder = _wpclsQueryFolder(_WPFolder, "<WP_DESKTOP>", TRUE); _wpclsSetError(_WPObject, 0); /* Reset the error indicators */ rc = 0; /* Attempt to find the first 10 objects matching our criteria */ ulCount = 10; rc = _wpclsFindObjectFirst(_WPObject, /* Class self pointer */ Class, /* Pointer to array of class objects */ &hFind, /* Handle for wpclsFindObjectNext */ NULL, /* Find EVERYTHING */ folder, /* Pointer to folder of interest */ TRUE, /* Search all folders in tree */ NULL, /* No extended criteria */ Object, /* Array of object pointers */ &ulCount); /* Number requested and number found */ errorid = _wpclsQueryError(_WPObject); /* Get errorid (may still be OK) */ if ((!rc && (errorid == WPERR_BUFFER_OVERFLOW)) || rc) { /***** Process objects found here ******/ } else { somPrintf("_wpclsFindObjectFirst failed, errorid=%u\n", errorid); return; } do { _wpclsSetError(_WPObject, 0); /* Reset error indicators */ rc = 0; /* Look for next 10 objects */ rc = _wpclsFindObjectNext(_WPObject, /* Self */ hFind, /* Handle from previous Find */ Object, /* Objects found */ &ulCount); /* Number to look for. On return, number found */ errorid = _wpclsQueryError(_WPObject); if ((!rc && (errorid == WPERR_BUFFER_OVERFLOW)) || rc) { /***** Process objects found here ******/ } else { somPrintf("_wpclsFindObjectNext failed, errorid=%u\n", errorid); return; } } while (errorid == WPERR_BUFFER_OVERFLOW); _wpclsSetError(_WPObject, 0); /* Reset error indicators */ rc = 0; /* Indicate find complete */ rc = _wpclsFindObjectEnd(_WPObject, hFind); if (!rc) { errorid = _wpclsQueryError(_WPObject); somPrintf("_wpclsFindObjectEnd failed, errorid=%u\n", errorid); return; } return; }