Solved

Change ActiveX Icon

Posted on 2001-07-27
7
242 Views
Last Modified: 2010-04-06
I wrote an ActiveX control(ActiveForm), it has a default icon. How can I change it?
Thanks,
ysimon
0
Comment
Question by:ysimon
  • 4
  • 3
7 Comments
 
LVL 21

Expert Comment

by:gemarti
ID: 6328675
Create a binary resource file (.RES) with Image Editor.

Create a 24Y24 bitmap. Give the bitmap a numeric name (2 for example).

Link the resource file to the ActiveX project with the $R compiler directive. (Linking resources was discussed on Day 8, "Creating Applications in Delphi" and is discussed further on Day 20, "Creating Components.")

Modify the ActiveX class factory creation routine in the implementation unit (the ActiveForm's .PAS file). A typical class factory creation routine looks like this (it's in the initialization section at the bottom of the unit):

TActiveFormFactory.Create(
    ComServer,
    TActiveFormControl,
    TMyFormX,
    Class_MyFormX,
    1,                    { Change this number. }
    `',
    OLEMISC_SIMPLEFRAME or OLEMISC_ACTSLIKELABEL,
    tmApartment);

Notice the line marked with a comment. This parameter of TActiveFormFactory.Create is the resource number of the bitmap you want displayed on the Component palette. If you saved the new bitmap with a name of 2, you would replace the 1 in this code snippet with a 2.

5. Rebuild, reregister, import, and install the ActiveForm again. The new bitmap should now show up in the Component palette.
0
 
LVL 21

Expert Comment

by:gemarti
ID: 6328698
Just in case your not sure how to link the resource file:

{$R *.res}     { links in resource file }
0
 

Author Comment

by:ysimon
ID: 6329029
There was a .res file in project files already. I found that the project didn't use it. If I change that number from 1 to 2, it will use a Delphi5 default icon. If I change ActiveX icon (1) and keep that number as 1, the icon is not changed. Do I create a new res file?

ysimon
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 21

Expert Comment

by:gemarti
ID: 6329739
Basically you create a new resource file. call it ...test.res

You add you ICONS and BITMAPS

You include the resource file in your activeX compilation...{$R test.res}

Build the project.
Close the project.
Click on Components | Import ActiveX control
Locate your ActiveX Form and and click install
If you get a warning that the file already exists tell it yes overwrite(make sure its your activeXform!)
It will want to compile it into dclusr.dpk. I selected okay here.
Click on the compile button
You should get a message that it has added the form to your activeX pallet.

Good luck.

0
 

Author Comment

by:ysimon
ID: 6332363
Yes, it works, thank you very much.

ysimon
0
 
LVL 21

Accepted Solution

by:
gemarti earned 50 total points
ID: 6332368
Glad to help. I guess you can close this question out.....
0
 

Author Comment

by:ysimon
ID: 6332646
Thanks again,
ysimon
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now