Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing windows files permissions by code
Message
From
20/11/2006 10:14:43
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
01171171
Message ID:
01171177
Views:
7
Thank you very much, I will try it.


>>Hello,
>>
>>Is it possible to change file permissions from VFP by code? I need to process a list of files to "Allow/Deny" access for "everyone".
>
>
*function SetAttribs
>lparameters tcFileName, tlReadOnly, tlHidden, tlSystem
>
>#define FILE_ATTRIBUTE_READONLY    0x00000001
>#define FILE_ATTRIBUTE_HIDDEN      0x00000002
>#define FILE_ATTRIBUTE_SYSTEM      0x00000004
>
>local lnNewAttr
>lnNewAttr = iif(tlReadonly,FILE_ATTRIBUTE_READONLY,0)+;
>	  iif(tlHidden,FILE_ATTRIBUTE_HIDDEN,0)+;
>	  iif(tlSystem,FILE_ATTRIBUTE_SYSTEM,0)
>
>declare integer SetFileAttributes in Win32API ;
>	string @ lpFileName,  integer dwFileAttributes
>declare integer GetFileAttributes in Win32API ;
>  string @ lpFileName
>
>return ( SetFileAttributes(@tcFilename, ;
>	bitor(bitand(GetFileAttributes(@tcFilename),0xFFFFFFF8),;
>        lnNewAttr)) = 1)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform