` Printed Icetips Article

Icetips Article



Par2: Icons in multi-DLL apps
1999-03-24 -- Chris Rybitski
 
It's quite simple, but it will require that you approach icon assignment in a slightly 
different manner -- i.e., you really can't assign icons in the IDE (windows formatter) 
using a resource .dll.

To start, you need to create the .dll.  You will do this by using a "Project" (.prj) file.
 
Start off by creating a dummy program source file (.clw) of whatever name.  For this 
example, my file will be named "ICOLIB32". The file will contain:

!----- Dummy source file for 'ICOLIB32.DLL'
       PROGRAM
       MAP
       END
       CODE
!------ End

Now you need an export file (.exp).  It will contain:

NAME icolib32 GUI

So now we have two files; "ICOLIB32.EXP" and "ICOLIB32.CLW".

In C5EE, create a "New" "Project".  Fill out the information as prompted. Be sure to 
indicate DLL as the target.  For "External source files", you should see the dummy 
source file name ("ICOLIB32.CLW").  "Target file" should be the .dll name.  Under 
"Library, object, and resource files", start adding the names of the icon files you want 
to link.  When you're done, compile.  You should end up with a .dll with nothing but 
icon files linked into it.  Icons can be accessed by ordinal offset(zero-based) in the
file.  What determines ordinal position? -- alphabetic sequence :)  The icons are 
arranged in alphabetic sequence.  What I do to handle assignments is create an 
INCLUDE file that contains an EQUATE for each icon resource. 
This can be added to any app I need and icon assignment becomes uniform. 
Here's an example:

Icon1     EQUATE('icolib32.dll[0]')
Icon2     EQUATE('icolib32.dll[1]')
Icon3     EQUATE('icolib32.dll[2]')
Icon4     EQUATE('icolib32.dll[3]')
Icon5     EQUATE('icolib32.dll[4]')
Icon6     EQUATE('icolib32.dll[5]')

Assignment would be:

0{PROP:Icon} = Icon1
-or-
?Image1{PROP:Text} = Icon1

I'm sure you get the idea.



Printed November 21, 2024, 11:39 am
This article has been viewed/printed 35198 times.