Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making a file Read-Only
Message
From
26/01/2000 10:22:48
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/01/2000 09:37:58
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00322772
Message ID:
00322808
Views:
19
>Hi!
>
>Anyone knows if it is possible to set a file's Read-Only attribute in VFP6 SP3?
>
>Thanks!


#define FILE_ATTRIBUTE_READONLY             0x00000001  
#define FILE_ATTRIBUTE_HIDDEN               0x00000002  
#define FILE_ATTRIBUTE_SYSTEM               0x00000004  
#define FILE_ATTRIBUTE_ARCHIVE              0x00000020  
#define FILE_ATTRIBUTE_NORMAL               0x00000080  
#define FILE_ATTRIBUTE_TEMPORARY            0x00000100  
#define FILE_ATTRIBUTE_OFFLINE              0x00001000  
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED  0x00002000

declare short SetFileAttributes in Win32API ;
  string @ lpFileName,;
  integer dwFileAttributes
declare integer GetFileAttributes in Win32API ;
  string @ lpFileName

lcFile = "c:\MyPath\SomeFile.Ext"
lnCurAttributes = GetFileAttributes(lcFile)
if bitand(lnCurAttributes,FILE_ATTRIBUTE_READONLY) = 0 && Attribute not set
  llSuccess = ( SetFileAttributes(lcFile, ;
                FILE_ATTRIBUTE_READONLY+lnCurAttributes) = 1 )
else
  llSuccess = ( lnCurAttributes # -1 ) && Function fail code
endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform