📄 doinstal.pas
字号:
unit DoInstal;
{ TCompress 3.0 routine to install a self-extracting archive from a
compressed resource -- no change from V2.5
See SELFEXTF.PAS or SELFXSML.DPR for detailed information on this file }
interface
procedure DoInstall(TargetDir, ExeFilename, ReadmeFilename: string);
implementation
uses WinTypes, WinProcs, Classes, SysUtils ,Compress;
const RESOURCE_NAME = 'MyArchiv';
procedure DoInstall(TargetDir, ExeFilename, ReadmeFilename: string);
var TempStream: TStream;
NameBuff: Array[0..255] of char;
Compress: TCompress;
begin
Compress := TCompress.Create(nil);
with Compress do
begin
TempStream := LoadCompressedResource(RESOURCE_NAME,'');
{ Right -- at this point TempStream has our compressed file in
a stream we can usefully access. Start at the beginning! }
try
RegNumber := 0; { your TCompress registration ID }
RegName := 'Your name';
MakeDirectories := True;
Targetpath := TargetDir;
if TempStream<>nil then
ExpandFilesFromStream(TempStream,nil); { get the lot }
finally
TempStream.free;
end;
end;
{$IFDEF CLR}
if ReadMeFileName<>'' then { if we get here, we should have expanded ok }
WinExec('NOTEPAD '+TargetDir+ReadMeFileName, sw_Show);
if EXEFileName<>'' then { if we get here, we should have expanded ok }
WinExec(TargetDir+EXEFileName, sw_Show);
{$ELSE}
if ReadMeFileName<>'' then { if we get here, we should have expanded ok }
WinExec(strPCopy(NameBuff,'NOTEPAD '+TargetDir+ReadMeFileName),sw_Show);
if EXEFileName<>'' then { if we get here, we should have expanded ok }
WinExec(strPCopy(NameBuff,TargetDir+EXEFileName),sw_Show);
{$ENDIF}
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -