Icons in a resource DLL

I tried to use a non-Clarion icon in a MESSAGE function and found that this is a runtime(?) property and I must therefore ship the *.ico file with the EXE/DLLs despite the fact that the same icon is already embedded in the DLL by virtue of another window.

I then created a resource DLL to store the icons once, rather than multiple times across various other DLLs, as well as a bunch of equates to point to the new icon DLL. Eg:

MYICON:Icon1 EQUATE(‘MYICONS.DLL[0]’)
MYICON:Icon2 EQUATE(‘MYICONS.DLL[1]’)
etc

This works fine for the MESSAGE icon, but if I try and use these equates on a button in a Window or Form by prepending it with an exclamation, !MYICON:Icon1, 2 things happen:

  1. I don’t see the icon in the IDE and
  2. the linker complains with an error: cif$ file open … cannot find file myicons.dll[0]

If I leave the icon off the button and assign it in an embed:
?Button3{PROP:Icon} = MYICON:Icon1
the application compiles, but again, I can’t see it in the IDE.

It seems that either method doesn’t work 100% of the time.

Does anyone have a solution that would work?

FYI, I have solved (more worked around) my MESSAGE icon issue by creating an equate that points to its own DLL.

Also, FYI, for various reasons, still using Clarion 5 PE.

Cheers,
Andrew

The last DLL that has a window OPEN() is the DLL that will be searched for icons.

I don’t know if there was PROP:ImageInstance in C5, but that’s one way to manage that stuff.

So in your resource DLL have a procedure that opens a dummy window (doesn’t have to be DISPLAY()'d. Then read System{PROP:ImageInstance} to a LONG.

Then you could have another procedure in your resource DLL that re-sets PROP:ImageInstance.

Not much in the C10 help about it. “A SYSTEM property that returns the HINSTANCE of the active EXE/DLL for use with linked-in image files.
Regarding icon/cursor resources: the runtime library looks for them not only in the executable that contains the value of PROP:ImageInstance, but also in the EXE or DLL where the current active window thread was loaded from.”