Solved

.ico file

Posted on 2000-03-25
1
247 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

16 Experts available now in Live!

Get 1:1 Help Now