Link to home
Start Free TrialLog in
Avatar of Jurica2505
Jurica2505

asked on

extract files

how to extract files from program or how to copy files from program to directory?
Avatar of edey
edey

Do you mean reasources that you have compiled into your exe? If so you would want to checkout TReasourceStream

GL
mike
listening
listening
Take a look at this link
http://www.gnomehome.demon.nl/uddf/pages/resource.htm

Regards
Umulig
Hi Jurica,

There is a our pending at
http://www1.experts-exchange.com/questions/10322797/How-to-run-programs-before-Windows-opened.html

Your trouble has better easy solution if you have Delhi 4 or above

#
At the menu Project->Resources open the Project resources.
RightClick the mouse and add a new type "RT_RCDATA"
After this select the file to incorporate inside you application.
You can repeat this to other file, the default name is RT_RCDATA_1.

Put the follow code to extract the resource file


function TMainFrm.XtractRes( DestFile : string ) : boolean;
var
  ZipRes : TResourceStream;
begin
  Result:=False;
  try
    ZipRes:=TResourceStream.Create( System.MainInstance, 'RT_RCDATA_1',                   'RT_RCDATA');
      try
                  ZipRes.SaveToFile( DestFile );
                except
        on E : exception do begin
              DeleteFile( DestFile );
              MessageDlg( 'I get the error: '#13 + E.Message, mtError, [mbOK], 0);
      end;
      end;
      ZipRes.Free;
      except
                     Result:=False;
                     Exit;
      end;
       Result:=True;
end;

T++, Radler.
If you are looking at integrating a Zip/Unzip functionality in to your Delphi app, try:

www.ziptv.com
ASKER CERTIFIED SOLUTION
Avatar of peteraa
peteraa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial