How do I get my containers to use Mini-icons?

Here is some sample code that displays mini icons. First, supply a missing #define:

 #ifndef CCS_MINIICONS
     #define CCS_MINIICONS 0x0800
 #endif // not CCS_MINIICONS

Use CCS_MINIICONS as part of your container style (when you create the container). Now, fill in the RECORDCORE structure pointed to by 'pRecordCore'; 'pUserRecord' also points to 'pRecordCore', which is part of a "user data" structure:

 // Fill in fields of container record.
 #ifdef USE_MINIRECORDCORE
     pRecordCore->cb = sizeof (MINIRECORDCORE) ;
 #else
     pRecordCore->cb = sizeof (RECORDCORE) ;
 #endif // USE_MINIRECORDCORE
     pRecordCore->flRecordAttr = 0 ; // CRA_DROPONABLE ;
     // pRecordCore->ptlIcon is left to zeros.
     pRecordCore->pszIcon = pUserRecord->szName ;
     if (*DDirRecord.szIconName)
        LoadIcon (pUserRecord) ;
     // pRecordCore->hptrMiniIcon is left to zeros.
     // pRecordCore->hbmBitmap is left to zeros.
     // pRecordCore->hbmMiniBitmap is left to zeros.
     // pRecordCore->pTreeItemDesc is left to zeros.

 #ifndef USE_MINIRECORDCORE
     pRecordCore->pszText = pUserRecord->szName ;
     pRecordCore->pszName = pUserRecord->szName ;
     pRecordCore->pszTree = pUserRecord->szName ;
 #endif // not USE_MINIRECORDCORE

Now, if your user asks for mini-icons (via a popup menu, presumably), you send a CM_SETCNRINFO message to your container, after ORing in the CV_MINI style to CnrInfo.flWindowAttr, or removing it to restore full-size icons. Hope this helps.

Credit: Wayne Kovsky


[Back: How do I stop a container from flashing every time I add a record?]
[Next: How do I sort a container control?]