January 1, 2005

WinTask - GetFileAttributes

'
' GetFileAttributes
'
' Author: Joe Strazzere
'

dim a as unsigned
file$="C:\msdos.sys"
a=External("kernel32","GetFileAttributesA",file$)
f$=""
if (a & (32)) <> 0 then
  f$=f$+"  Archive"+crlf
endif
if (a & (800 * 256)) <> 0 then
  f$=f$+"  Compressed"+crlf
endif
if (a & (16)) <> 0 then
  f$=f$+"  Directory"+crlf
endif
if (a & (2)) <> 0 then
  f$=f$+"  Hidden"+crlf
endif
if (a & (8 * 16)) <> 0 then
  f$=f$+"  Attribute-less"+crlf
endif
if (a & (1)) <> 0 then
  f$=f$+"  Read-Only"+crlf
endif
if (a & (64)) <> 0 then
  f$=f$+"  System"+crlf
endif
msgbox("Attributes for "+file$+":"+crlf+crlf+f$,0,"GetFileAttributes")