Enumerates all groups inside the class object's associated vector handle.
#include "ltwrappr.h"
virtual L_INT LVectorBase::EnumGroups()
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The LVectorBase::EnumGroups function calls the LVectorBase::EnumGroupsCallback function as it gets a pointer to each vector group.
To use the LVectorBase::EnumGroupsCallBack function, you must derive a class from LVectorBase and override the LVectorBase::EnumGroupsCallBack member function.
This example enumerates through all groups in a vector.
#ifdef LMyVectorBase5
class LMyVectorBase5: public LVectorBase
{
public:
L_INT m_nGroupCount ;
public:
LMyVectorBase5() {m_nGroupCount=0;};
virtual ~LMyVectorBase5(){};
virtual L_INT EnumGroupsCallBack(pVECTORHANDLE pVector, pVECTORGROUP pGroup);
};
#endif // #ifdef LMyVectorBase5
L_INT LMyVectorBase5::EnumGroupsCallBack(pVECTORHANDLE pVector, pVECTORGROUP pGroup)
{
UNREFERENCED_PARAMETER(pVector);
LVectorGroup VectorGroup(pGroup, this);
L_TCHAR szMsg[100];
m_nGroupCount++;
VECTORGROUPDESC GroupDesc;
VectorGroup.GetGroupDesc(&GroupDesc);
wsprintf(szMsg, TEXT("Group\nName[%s]\nSize[%d]"),
GroupDesc.szName,
GroupDesc.nSize
);
MessageBox(NULL, szMsg, TEXT(""), MB_OK);
return SUCCESS ;
//...LVectorGroup destructor called when VectorGroup goes out of scope
}
L_INT LVectorBase__EnumGroupsExample(HWND hWnd, LMyVectorBase5 *pMyVector)
{
UNREFERENCED_PARAMETER(hWnd);
L_INT nRet;
LMyVectorBase5 MyVector;
L_TCHAR szMsg[100];
pMyVector->m_nGroupCount=0;
pMyVector->EnableCallBack(TRUE);
nRet = pMyVector->EnumGroups();
if(nRet != SUCCESS)
return nRet;
wsprintf(szMsg, TEXT("Total Groups[%d]"), pMyVector->m_nGroupCount);
MessageBox(NULL, szMsg, TEXT(""), MB_OK);
return SUCCESS;
}