#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnEnumerate(hObject, pfnCallback, pUserData, uFlags, pUserList)
HANNOBJECT hObject; |
/* handle of the container object */ |
ANNENUMCALLBACK pfnCallback; |
/* callback function for each object */ |
L_VOID *pUserData; |
/* pointer to more parameters for the callback */ |
L_UINT uFlags; |
/* flags that determine which objects to process */ |
L_TCHAR *pUserList; |
/* character string that contains the user list */ |
Lets you process all of the annotation objects in a container.
Parameter |
Description |
|
hObject |
Handle of the container object. |
|
pfnCallback |
Callback function for processing each enumerated object. Use the function pointer as the value of this parameter. |
|
|
L_AnnEnumerate calls this callback function as it gets the handle of each annotation object. The callback function must adhere to the function prototype described in ANNENUMCALLBACK Function. |
|
pUserData |
Void pointer that you can use to pass one or more additional parameters that the callback function needs. |
|
|
To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure. |
|
|
If the additional parameters are not needed, you can pass NULL in this parameter. |
|
uFlags |
Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values: |
|
|
Value |
Meaning |
|
0 |
Process only the specified object. |
|
ANNFLAG_SELECTED |
[0x0001] Process only objects that have the selected property set to TRUE. For getting and setting the selected property, use the L_AnnGetSelected and L_AnnSetSelected functions. |
|
ANNFLAG_NOTTHIS |
[0x0004] Process only one level of objects within the specified container, not the container itself. |
|
ANNFLAG_RECURSE |
[0x0008] Process objects within a container, and within any subcontainers, down to any level. |
|
ANNFLAG_NOTCONTAINER |
[0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves. |
|
ANNFLAG_USER |
[0x0040] Process only those objects that have a user included in pUserList. If pUserList is NULL, process only those objects that do not have an associated user. |
pUserList |
Character string that contains the list of users associated with the specified object. pUserList has the form "User1,User2,,UserN". This must be a NULL terminated string with user names separated by a comma. This parameter is valid only if ANNFLAG_USER is set in uFlags. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
You pass the handle of the container object in the hObject parameter, and you specify your callback function that is to process each object in the container. The L_AnnEnumerate function calls your callback function as it gets the handle of each annotation object.
You should not call this function during processing of WM_LTANNEVENT if wParam equals LTANNEVENT_REMOVE or LTANNEVENT_INSERT, or during the ANNENUMCALLBACK callback function
Required DLLs and Libraries
LTANN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
See Also
Functions: |
|
|
|
Topics: |
|
|
|
|
|
|
|
|
Example
This ANNENUMCALLBACK function updates a count of the number of rectangles, ellipses, and polygons, as it processes each annotation object. This example uses a callback function to count the number of rectangles, ellipses, and polygons.
L_INT EXT_CALLBACK TestAnnCallback (HANNOBJECT hObject, L_INT* pUserData) { L_UINT ObjectType; /* The type of annotation object */ L_INT ObjectCount; /* The number of objects */ /* Initialize the object count */ ObjectCount = (L_INT) *pUserData; /* Get the current object type */ L_AnnGetType (hObject, &ObjectType); /* Update the counter if the object is a rectangle, ellipse, or polygon */ if ((ObjectType == ANNOBJECT_RECT) || (ObjectType == ANNOBJECT_ELLIPSE) || (ObjectType == ANNOBJECT_POLYGON)) { ++ObjectCount; } /* Update the caller's variable */ *pUserData = ObjectCount; return SUCCESS; } L_INT AnnEnumerateExample(HANNOBJECT hContainer)/* Container annotation object */ { L_INT nRet; L_TCHAR szMessage[80]; ANNENUMCALLBACK pfnCallback; /* Proc pointer for WIN16 compatibility */ L_INT ObjectCount; /* Counter for annotation objects */ L_INT* pCount = &ObjectCount; /* Pointer to the object counter */ /* Set the callback function */ pfnCallback = (ANNENUMCALLBACK) MakeProcInstance( (FARPROC) TestAnnCallback, hInst ); /* Initialize the object count */ ObjectCount = 0; /* Process every object in the root container */ /* Refer to the callback function below to see how the count is updated */ nRet = L_AnnEnumerate(hContainer, pfnCallback, pCount, ANNFLAG_RECURSE, NULL); if(nRet != SUCCESS) return nRet; /* Display a message box with the result */ wsprintf (szMessage, TEXT("%d rectangles, ellipses, and polygons"), ObjectCount); MessageBox (NULL, szMessage, TEXT("Notice"), MB_OK); /* Free the callback function */ FreeProcInstance((FARPROC) TestAnnCallback); return SUCCESS; }