Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to change the attribute of a file ?
Message
From
31/08/1998 07:29:05
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00131296
Message ID:
00131454
Views:
15
>>>When a file is copied from a cd-rom to harddrive, that file is read-only. Is there any simple way to change the attribute using foxpro(vfp 3.0) commands ?
>>
>>I found the answer to this in the knowledge base here in U.T. - it came in quite handy. I have my code at work rather than here at home, tho - let me know if you cannot find it in the U.T.K.B. and I'll dredge out a code snippet from my own spagetti code at work.
>
>Try:
>
>
>
>DECLARE INTEGER SetFileAttribute IN WIN32API STRING cFileName, INTEGER nFileAttributeMask
>
>cFileName = cMyFullPathWithNoWildCards
>nMyFileMask = nAttributeMaskExpression && (see below for mask bit values)
>
>IF (SetFileAttribute(cFileName, nMyFileMask) = 1)
>   * it succeeded
>ELSE
>   * it didn't
>ENDIF
>
>
>The full set of attribute masks is found in WINBASE.H; the most useful values are:
>
> R = Read-only 1
> H = Hidden 2
> S = System 4
> A = Archive 32
>
>Turn on an attribute by adding its value; for example, to make a file Hidden, Read-Only and System, use 1 + 2 + 4 for the attribute mask value; to set Normal, use 0.
>
>hth,
>
>Ed

It's SetFileAttributes, not SetFileAttribute
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform