Solved

.ico file

Posted on 2000-03-25
1
254 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
1 Comment
 
LVL 17

Accepted Solution

by:
inthe earned 100 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
select query - oracle 16 100
Firemonkey android show image from resource ? 1 46
how to resize animated Gif image in delphi ? 1 35
Delphi and Access based Enumeration 9 71
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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