par Michael DELIQUE » 05 Nov 2007 à 17:41
- Code : Tout sélectionner
Function FileAttributes_API(wPathFile As String, nbAttribute As Integer) As Long
%REM
'variable API pour la fonction FileAttributes_API
Public Declare Function SetFileAttributes Lib "kernel32" Alias "SetFileAttributesA" (ByVal lpFileName As String,ByVal dwFileAttributes As Long) As Long
%END REM
'déclaration Variable
On Error Goto ErreurHandle
If Trim(wPathFile) = "" Then
FileAttributes_API = 0
Exit Function
End If
Select Case nbAttribute
Case 0 ' Normal (Pas d'Attribut)
Case 1 'Read Only - Lecture seule
Case 2 'Hidden - Caché
Case 3 'Read Only & Hidden - Lecture seule/caché
Case Else
Error 9999,"Mauvais attribut de fichier : "+Cstr(nbAttribute)
Exit Function
End Select
FileAttributes_API = SetFileAttributes (wPathFile, nbAttribute)
Exit Function
ErreurHandle:
Msgbox "("+Structure_Log+" : "+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
FileAttributes_API = 0
Exit Function
End Function
Cordialement
Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN