Announcement

Collapse
No announcement yet.

Attributes ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Attributes ?

    Hallo,
    warum kommt der Fehler: [Fehler] Unit10.pas(91): Operator ist auf diesen Operandentyp nicht anwendbar

    procedure TForm10.FormCreate(Sender: TObject);
    var
    attributes,nattributes : word;
    begin
    Attributes :=FileGetAttr('Registrierung.DB');
    FileSetAttr ('Registrierung.DB',attributes and not faReadOnly);
    end;
    ...

    Danke und Gruß
    Karl-Heinz

  • #2
    Weil faReadOnly nicht negiert werden kann. Probiere mal eine simple Subtraktion.<p>
    Mari
    Schöne Grüße, Mario

    Comment


    • #3
      gleicher Fehler. Ich habe das "and not" aus der D Hilfe zu FileSetAttr

      Comment


      • #4
        anders gefragt, wie setze ich eine Datei auf nicht ReadOnly

        Comment


        • #5
          Ich habe es bei mir mal ausprobiert und es funktioniert (Delphi 6). Hast Du vielleicht faReadonly irgendwo anders noch einmal deklariert ? Geh mal mit der rechten Maustaste auf faReadonly und lasse Die die Deklaration anzeigen. Die Deklaration sollte aus der Unit sysutils kommen (faReadOnly = $00000001 platform
          Dazu kannst Du auch FileSetAttr ('Registrierung.DB',attributes and not sysutils.faReadOnly); versuche

          Comment


          • #6
            Hi Karl-Heinz,

            versuch mal dies:

            <pre>FileSetAttr ('Registrierung.DB',attributes and (not faReadOnly));</pre>

            Wichtig sind die Klammern.

            Gruß
            Richar

            Comment


            • #7
              Hallo Richard,
              klingt logisch - ist leider nicht die Lösung.
              Gruß
              K-

              Comment


              • #8
                Wie ist denn das, wenn Du die Attribute vorher zusammensetzt und dann an die Funktion übergibst?
                <code>
                attributes := attributes and not faReadOnly;
                FileSetAttr ('Registrierung.DB',attributes);
                </code>
                .
                <quote><i>
                anders gefragt, wie setze ich eine Datei auf nicht ReadOnly?
                </i></quote>
                Zusammensetzen verschiedener Attribute mit "or", abziehen eines Attributes mit "and not"

                Comment


                • #9
                  gleicher Fehler hinter faReadOnly. Kann das bei mir liegen ? Versucht das doch bitte auch mal

                  Comment


                  • #10
                    Hi Karl-Heinz,
                    .
                    ich hatte eigentlich gedacht, dass Du den Tip von Frank Kneffel schon getestet hattest, bei mir gehts so jedenfalls:
                    <code>
                    var
                    attributes: word;
                    begin
                    ...
                    attributes := attributes and not sysutils.faReadOnly;
                    FileSetAttr ('c:\test.txt',attributes);
                    end;
                    </cod

                    Comment


                    • #11
                      Hallo Michael,
                      Hallo Frank,
                      sorry, der Beitrag von Frank ist mir durchgerutscht. Das war die Lösung. Nächstesmal passe ich besser auf.
                      Nochmals Danke und viele Grüße
                      Karl-Hein

                      Comment

                      Working...
                      X