?
Solved

.ico file

Posted on 2000-03-25
1
Medium Priority
?
258 Views
Last Modified: 2010-05-18
Greetings,

I want to write a .ico file to local hard disk from an .exe
How do I pack this into the exe and then "unpack" it.

Many thanks,

Mal
0
Comment
Question by:malcx
[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
1 Comment
 
LVL 17

Accepted Solution

by:
inthe earned 400 total points
ID: 2657205
Hi
you can store the extra ico in the apps resource file by following the directions below.
make a new file in notepad that looks like:

 TESTFILE  EXEFILE C:\TEST.ICO

and save file as myres.rc

compile myres.rc with brcc32.exe in delph bin directory to get a file called myres.res .

then in delphi app in your unit do:

{$R *.DFM}

{$R MYRES.RES}//add file here

procedure ExtractRes(ResType, ResName, ResNewName : String);
      var
        Res : TResourceStream;
      begin
        Res := TResourceStream.Create(Hinstance, Resname, Pchar(ResType));
        Res.SavetoFile(ResNewName);
        Res.Free;
      end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ExtractRes('EXEFILE','TESTFILE','C:\TEST_ICO_FROM_RES.ICO');
end;


now when project is build the ico is added to the applications exe fiel and when you want to extract it to the hard disk just do the button click.

Regards Barry
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

719 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