>I want to change WordPerfect file attributes (make them read only) programmatically with VFP. Is there some tricks or API function I can use.
Hello Michel. I just cut these from a library file I have been writing for a client. You may need to adjust them a little to suit your needs.
Enjoy.
*********************************************************
FUNCTION SetAttr
PARAMETER zFileName, zAttribute
zAttribute = UPPER(zAttribute)
Private zReturn, zForNext, zAttrib, zX, S,H,R,A
zReturn = ''
S = 0
H = 0
R = 0
A = 0
N = 0
zX = 0
zx = ATCC('S',zAttribute)
IF (zX > 0)
S = 4
ENDIF
zx = ATCC('H',zAttribute)
IF (zX > 0)
H = 2
ENDIF
zx = ATCC('R',zAttribute)
IF (zX > 0)
R = 1
ENDIF
zx = ATCC('A',zAttribute)
IF (zX > 0)
A = 32
ENDIF
zx = ATCC('N',zAttribute)
IF (zX > 0)
N = 128
ENDIF
declare integer SetFileAttributes IN kernel32 AS SetAtt STRING, INTEGER
zAttrib = (A + R + H + S + N) && Establish attributs to set.
zX = Setatt(zFileName,zAttrib) && Set 'em
zReturn = IIF(zX = 1,.T.,.F.) && Establish return value
RETURN (zReturn)
*** EOP ***
~Joe Johnston USA
"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams