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:

  1. Look in the resources of bricscad.exe for built in icons.
  2. 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.
  3. 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.
  4. Look for a separate bitmap file in the same folder as the CUI file
  5. 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?

  1. Create a ZIP file with the bitmap files (do not put the bitmaps in folders)
  2. Rename the zip file: same name as CUI file, RESZ extension
  3. Put the RESZ file in the same folder as the CUI file