Well since you're learning C++/Arx, here is a sample for you. (attached ARX for 2007)
the function is (crpselectedlayouts)
static int ads_crpselectedlayouts(void)
{
// this is our "list" we will return to lisp.
// we need to keep a copy of the head of the list
// and add to the tail.
struct resbuf *pRbHead = acutNewRb(RTLB);
struct resbuf *pRbTail = pRbHead;
// get the database.
AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();
// open the layout dictionary.
// a smart pointer will manage our pointer for us.
AcDbDictionaryPointer pLayouts(pDb->layoutDictionaryId(),AcDb::kForRead);
// create a new iterator.
// we need to delete this or LEAK!!!
AcDbDictionaryIterator *pDictIt = pLayouts->newIterator();
//iterate the dictionary looking for layouts that are selected
for(;!pDictIt->done();pDictIt->next())
{
// another smart pointer.
AcDbObjectPointer<AcDbLayout> pLayout(pDictIt->objectId(),AcDb::kForRead);
// if it's selected add it to our resbuf (list).
if(pLayout->getTabSelected())
{
TCHAR *pszLayoutName;
// the Arx docs say do not free pszLayoutName.
pLayout->getLayoutName(pszLayoutName);
// add new to the end of the list.
pRbTail = pRbTail->rbnext = acutBuildList(RTSTR,pszLayoutName,0);
}
}
// return the list to lisp, AutoCAD will make a copy.
// so we will need to free the memory or LEAK!!!
acedRetList(pRbHead->rbnext);
//clean up our iterator
delete pDictIt;
// free up the list
if(pRbHead != NULL)
{
acutRelRb(pRbHead);
pRbHead = NULL;
}
return (RSRSLT) ;
}