Jurica2505
asked on
extract files
how to extract files from program or how to copy files from program to directory?
listening
listening
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.Cr eate( 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.
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.Cr
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
www.ziptv.com
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
GL
mike