Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OFSO = CREATEOBJECT('Scripting.FileSystemObject') not wo
Message
De
23/07/2012 09:49:41
 
 
À
23/07/2012 09:40:57
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01548984
Message ID:
01549002
Vues:
59
>>Yes, I came back three months ago. Being away from my family made me homesick.
>>
>I can understand that.
>but now back to my problem
>I use you code like that:
>
>
>nAttribute=1
>declare integer SetFileAttributes IN kernel32 STRING, INTEGER 
>x1=SetFileAttributes(thisform.lcFilename,nAttribute)
>
>it returns 1 in x1
>but he read only flag does not change :-((
>
>peter

That's strange, I have never had any problems with it, Maybe it will return the wrong value if the file in question is in use by another value? Or maybe the OS needs some time to release the file handle? Try to use SetAttr and GetAttr in a little loop with for instance five tries and a little delay before it gives up.

Here's my corresponding GetAttr function:
Function GetAttr
   Parameter zFileName && This is a complete filespec.

   Private zADIR, zReturn, zAReturn, zAttribute, zForNext, zAt

   zAReturn = Adir(zADIR, zFileName,'rhsa')
   zReturn = ''

   If zAReturn = 1 && check for bad filename
      zAttribute = zADIR[5] && get our attributes
      For zForNext = 1 To 5 && Loop through attribs
         zAt = Substr(zAttribute,zForNext,1) && pull out 1 char
         If zAt != '.' && skip 'blanks'
            zReturn = (zReturn + zAt) && set the return up
         Endif
      Endfor
   Else
      zReturn = '?' && Indicate a bad filename
   Endif

Return (zReturn)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform