This example shows how you can use the wpInitIconPosData, wpIdentify, wpQueryIconPosition, and wpFreeIconPosData methods to find the icon position information for all objects within a folder. In this example, somSelf contains the pointer to the folder being examined.
BOOL bSem; WPObject *Object; CHAR szIdentity[CCHMAXSTRING]; POINTL ptl; ULONG ulIndex; /* Retrieve the icon position information for all objects within the * folder */ _wpInitIconPosData(somSelf); /* Find the every object within the folder */ bSem = !_wpRequestObjectMutexSem(somSelf,SEM_INDEFINITE_WAIT); for (Object = _wpQueryContent(somSelf,NULL,QC_FIRST); Object; Object = _wpQueryContent(somSelf,Object,QC_NEXT)); { /* For each object in the folder, find the position of its icon * in an Icon View of the folder */ if (_wpIdentify(Object,szIdentity)) { if (_wpQueryIconPosition(somSelf,szIdentity,&ptl,&ulIndex)) { /***** ptl contains the position of the icon for this object *****/ } } } if (bSem) { _wpReleaseObjectMutexSem(somSelf); } /* Free the icon position data structure */ _wpFreeIconPosData(somSelf);