Autor Beitrag
rokdd
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 329

Win XP
D6
BeitragVerfasst: Fr 18.07.03 17:20 
[delphi][code]procedure Tfrm_menu.BitBtn3Click(Sender: TObject);
var
sr: TSearchRec;
FileAttrs: Integer;
s:string;
begin
FileAttrs := 1;
with frm_kommentar.dateien do
begin
if FindFirst(frm_menu.lbl_file.caption, FileAttrs, sr) = 0 then
begin
repeat
if (sr.Attr and FileAttrs) = sr.Attr then
begin
Messagedlg(sr.Name,mtinformation,[mbYes],0);
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;
end;[/code][/delphi]
Funktioniert nicht richtig. Warum???
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Fr 18.07.03 17:52 
Du setzt als Attribut immer fsReadOnly, wunderst dich aber, dass TSearchRec.Attr und fsReadOnly nicht gleich sind.

TSearchRec.Attr gibt alle Attribute an.
Das ist mehr als Schreibgeschützt.

Außerdem, hat es irgend einen Sinn, dass du nur nach schreibgeschützten Dateien suchst?

Das hier ist Mist:
ausblenden Delphi-Quelltext
1:
if (sr.Attr and FileAttrs) = sr.Attr then					

wenn du das wirklich abfragen willst musst du folgendes schreiben:
ausblenden Delphi-Quelltext
1:
if (sr.Attr and FileAttrs) <> 0 then					


Kleiner Tipp:
Das steht alles in der Onlinehilfe.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.


Zuletzt bearbeitet von derDoc am Fr 18.07.03 17:55, insgesamt 1-mal bearbeitet
rokdd Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 329

Win XP
D6
BeitragVerfasst: Fr 18.07.03 17:54 
ja, stimmt. danke!!!!