How to use resource DLLs for toolbar icons?
When there are many toolbar icons, they can be better managed if they are bundled in a resource DLL or RESZ archive.
BricsCAD searches for the icons for its toolbars using the following sequence:
- Look in the resources of bricscad.exe for built in icons.
- Look in a DLL that has the same name as the loaded menu. If the external menu has a name myToolbars.cui, then the resource DLL should have the name myToolbars.dll.
- Look in a RESZ file that has the same name as the loaded menu. If the external menu has a name myToolbars.cui, then the resource DLL should have the name myToolbars.resz. A RESZ file is a ZIP file containing the icons.
- Look for a separate bitmap file in the same folder as the CUI file
- Look for a separate bitmap file in any folder that is in SRCHPATH variable.
So, the practical approach is to create a resource DLL or RESZ archive with the same name as the menu it accompanies.
Note:
How to create a resource DLL?
In Visual Studio, see Creating a Resource-Only DLL: https://docs.microsoft.com/en-us/cpp/build/creating-a-resource-only-dll?redirectedfrom=MSDN&view=msvc-160&viewFallbackFrom=vs-2019
How to create a RESZ archive?
- Create a ZIP file with the bitmap files (do not put the bitmaps in folders)
- Rename the zip file: same name as CUI file, RESZ extension
- Put the RESZ file in the same folder as the CUI file