Using .ICO files as IconRsc for building ButtonGroups

I've been able to create Windows Icon files (.ico) and define IconRsc items using them (with ICONFORMAT_WINDOWSICO). In my ButtonGroup, I have enties for these IconRsc defs, and everything works fine. The .ico files are in an "icon" folder under the "mdlapps" folder (pointed to by MS_ICONPATH). Now I'm getting quite a large collection of ico files. I think I understand that one can also "store" the icon definitions in a .dll file, and I think I know how to get them into one. The missing part for me (so far) is what ties the icon in the DLL to what you need for/in the resource compiler. In the definition of the IconRsc, the "data" parameter for the IconRsc is the name of the .ico file, and as long as that .ico file is found in a location pointed to be MS_ICONPATH, things are fine. But if the icons are in a DLL file (pointed to by MS_ICONLIBRARYLIST?), what connects the icon from the DLL to the IconRsc, as the IconRsc is using a string, and the DLL has a numeric ID?

Thanks,

Bruce

  • Solved:

    I discovered that you can set the ID property of the icon in the DLL file to a quoted string instead of a number. That quoted string becomes the name used in the IconRsc definition on the MDL side. Make sure MS_ICONLIBRARYPATH points to your DLL.

  • Bruce,

    Another way to do this is to compile your ico files into a resource file using the Wiconpackager delivered with the MicroStationSDK which should be in the mdl\bin directory. An example mke file to do this would look like...

    #----------------------------------------------------------------------------------------

    #  Compile ico files into a rsc file that can be specified in MS_ICONRSCLIST

    #----------------------------------------------------------------------------------------

    %include mdl.mki

    baseDir     = $(_MakeFilePath)

    appName     = myicons

    #----------------------------------------------------------------------

    #   Create the output directory

    #----------------------------------------------------------------------

    $(o)$(tstdir)       : $(o)$(tstDir)

    #----------------------------------------------------------------------

    #   Specify Rsc file to create

    #----------------------------------------------------------------------

    rscFile      = $(msIconDir)$(appName).rsc

    #----------------------------------------------------------------------

    #   The list determines the order of the icos in the resource file

    #----------------------------------------------------------------------

    filelist = \

       $(baseDir)one.ico \

       $(baseDir)twoico \

       $(baseDir)three.ico \

       $(baseDir)last.ico \

    $(rscFile) : $(filelist)                                                  

       > $(o)filelist.opt

       $(filelist)

       <

       wiconpackager -o$(rscFile) @$(o)filelist.opt

    HTH, Bill