Set File AttributeTag(s): Powerscript


[external function declaration]
FUNCTION boolean SetFileAttributesA &
   (string lpFileName, unsignedlong dwFileAttributes) &
      LIBRARY "Kernel32.DLL"


[powerscript]
/*
#define FILE_ATTRIBUTE_READONLY         0x00000001
#define FILE_ATTRIBUTE_HIDDEN           0x00000002
#define FILE_ATTRIBUTE_SYSTEM           0x00000004
#define FILE_ATTRIBUTE_DIRECTORY        0x00000010
#define FILE_ATTRIBUTE_ARCHIVE          0x00000020
#define FILE_ATTRIBUTE_NORMAL           0x00000080
#define FILE_ATTRIBUTE_TEMPORARY        0x00000100
#define FILE_ATTRIBUTE_COMPRESSED       0x00000800
#define FILE_ATTRIBUTE_OFFLINE          0x00001000
*/

CONSTANT unsignedlong FILE_ATTRIBUTE_READONLY = 1
CONSTANT unsignedlong FILE_ATTRIBUTE_HIDDEN = 2
CONSTANT unsignedlong FILE_ATTRIBUTE_SYSTEM = 4
CONSTANT unsignedlong FILE_ATTRIBUTE_ARCHIVE = 32
CONSTANT unsignedlong FILE_ATTRIBUTE_NORMAL = 128


IF NOT SetFileAttributesA("myfile.dat", FILE_ATTRIBUTE_READONLY) THEN
   MessageBox("Error", "can't set r/o attribute", Exclamation!)
END IF

blog comments powered by Disqus