Uit de Delphi help:
Zie trouwens ook dit topic over hoe je hier een goed topic moet openen.
Voortaan doe je best zelf eerst eens een poging om een en ander in de help op te zoeken.Every file has various attributes stored by the operating system as bitmapped flags. File attributes include such items as whether a file is read-only or a hidden file.
Changing a file's attributes requires three steps:
1. Reading file attributes.
2. Changing individual file attributes.
3. Setting file attributes.
You can use the reading and setting operations independently, if you only want to determine a file's attributes, or if you want to set an attribute regardless of previous settings. To change attributes based on their previous settings, however, you need to read the existing attributes, modify them, and write the modified attributes.
Reading file attributes
Operating systems store file attributes in various ways, generally as bitmapped flags.
To read a file's attributes, pass the file name to the FileGetAttrfunction. The return value is a group of bitmapped file attributes, of type Word.
Changing individual file attributes
Because Delphi represents file attributes in a set, you can use normal logical operators to manipulate the individual attributes. Each attribute has a mnemonic name defined in the SysUtils unit.
For example, to set a file's read-only attribute, you would do the following:
Attributes := Attributes or faReadOnly;
You can also set or clear several attributes at once. For example, the clear both the system-file and hidden attributes:
Attributes := Attributes and not (faSysFile or faHidden);
Setting file attributes
Delphi enables you to set the attributes for any file at any time.
To set a file's attributes, pass the name of the file and the attributes you want to the FileSetAttr function.
Zie trouwens ook dit topic over hoe je hier een goed topic moet openen.
[ Voor 4% gewijzigd door whoami op 12-04-2003 13:58 ]
https://fgheysels.github.io/
Dit topic is gesloten.
![]()