Jump to content
Wil van Antwerpen

Adding an icon for an ActiveX control

Recommended Posts

Hi,

 

I wrote an ActiveX component with Delphi 10.4.2 and the users are happy with it.
There's lots of legacy software out there and this helps them.


One of the things I am looking into now is how-to add an icon for using it in other development tools.

On the toolbox pane in VB6 it shows up as a black square now and that's not very ideal.

See below:

image.png.c2577250661bee5630f1be4a5328e16e.png

 

From what I've found so far, it has to be an image of 16x15 pixels and only 16 colors (oh dear).
Hopefully one can add higher resolutions as well for other environments.

There was also some mention of adding it as resource (.dcr) file, which I tried, but so far, no cigar.

 

Somehow I'm not finding much details on this. LOL
Ideas welcome, maybe someone down here remembers and is willing to share that tidbit.

Thanks.

 

Share this post


Link to post

https://docs.microsoft.com/en-us/windows/win32/com/activex-controls-registry-information

 

You can add the 16x15 bitmap to your Delphi project using Project > Resources and Images.

 

Searching the Delphi source for "ToolboxBitmap32" I can see that TActiveXControlFactory has a ToolboxBitmapID property which you can use to specify the resource ID of the bitmap. The value of this property is written to the registry when the ActiveX control is registered.

 

3 hours ago, Wil van Antwerpen said:

There was also some mention of adding it as resource (.dcr) file, which I tried, but so far, no cigar.

A .dcr file usually just contains the Delphi design time glyph of a component - I.e. the glyph you see on the component palette in Delphi. It has nothing to do with ActiveX controls.

  • Like 1
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×