Solved

Change ActiveX Icon

Posted on 2001-07-27
7
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month8 days, 17 hours left to enroll

617 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