
03.07.2008, 21:29
|
|
Участник форума
Регистрация: 25.05.2007
Сообщений: 290
С нами:
9980798
Репутация:
435
|
|
Копирование файла:
PHP код:
procedure CopyFile(Source, Dest: string);
var
SrcFile: Integer;
DestFile: Integer;
S: string;
RetCode: Longint;
OpenFileBuf: TOFStruct;
FName: array[0..255] of Char;
begin
StrPCopy(FName, Source);
SrcFile := LZOpenFile(FName, OpenFileBuf, of_Read);
StrPCopy(FName, Dest);
DestFile := LZOpenFile(FName, OpenFileBuf, of_Create);
RetCode := LZCopy(SrcFile, DestFile);
if RetCode >= 0 then
begin
LZClose(SrcFile);
LZClose(DestFile);
end
else
begin
Str(RetCode, S);
MessageDlg('Не могу скопировать ' + Source + ' в ' +
Dest + #13 + 'Код ошибки = ' + S, mtError, [mbOk], 0);
end;
end;
Системная директория:
PHP код:
procedure TForm1.Button1Click(Sender: TObject);
var
Windir: string;
WindirP: PChar;
Res: Cardinal;
begin
WinDirP := StrAlloc(MAX_PATH);
Res := GetWindowsDirectory(WinDirP, MAX_PATH);
if Res > 0 then
WinDir := StrPas(WinDirP);
Label1.Caption := WinDir;
end;
Путь до экзешника (непродуманно сделанно)
PHP код:
Label1.Caption:=LeftStr(Application.ExeName,length(Application.ExeName)-length(Application.Title)-4);
|
|
|