Sets The Attributes For A File Or Directory Using API In PowerBuider
1 2 | //[External Function Declaration] Function Boolean SetFileAttributesA(Ref String lpFileName, ULong dwFileAttributes) Library "KERNEL32.DLL" Alias For "SetFileAttributesA;Ansi" |
PowerScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | //[powerscript] CONSTANT ulong FILE_ATTRIBUTE_READONLY = 1 CONSTANT ulong FILE_ATTRIBUTE_HIDDEN = 2 CONSTANT ulong FILE_ATTRIBUTE_SYSTEM = 4 CONSTANT ulong FILE_ATTRIBUTE_DIRECTORY = 10 CONSTANT ulong FILE_ATTRIBUTE_ARCHIVE = 32 CONSTANT ulong FILE_ATTRIBUTE_NORMAL = 128 CONSTANT ulong FILE_ATTRIBUTE_TEMPORARY = 256 CONSTANT ulong FILE_ATTRIBUTE_COMPRESSED = 2048 If Not SetFileAttributesA("c:\temp\myfile.txt", FILE_ATTRIBUTE_READONLY) Then MessageBox("Error", "can not set attribute", Exclamation!) End If |
Good Luck!