Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
function FileSetAttr(const sFileName: string; Attr : integer): integer;
Sets the attributes of a specified file.
FileSetAttr returns 0 (zero) if the function was successful, non-zero value (error code) otherwise.
The value of Attr is formed by combining the appropriate file attribute constants:
faReadOnly 1 Read-only files.
faHidden 2 Hidden files
faSysFile 4 System files
faVolumeID 8 Volume ID files
faDirectory 16 Directory files
faArchive 32 Archive files
faSymLink 64 Symbolic link
faAnyFile 71 Any file
var mp3File : string;
Attrs : integer;
mp3File := 'c:\My Documents\mp3\my_song.mp3'
Attrs := FileGetAttr(mp3File);
//mark mp3File as hidden (if not hidden already)
if (Attrs and faHidden) = 0 then
FileSetAttr(mp3File, Attrs or faHidden);
|
Your first MP3 Delphi player
See how to build a full-blown mp3 player with Delphi in just a few seconds. Even more: get the ID3 tag information from a mp3 file and change it!
TFindFile VCL
Tired of using FindFirst, Next and Close? Come see how to encapsulate all those functions in a single "find-files-recursively" component. It's easy to use, free and with code.
FileSetReadOnly, FileGetAttr,
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|