Récupérer le répertoire temporaire de windows et de Notes

Récupérer le répertoire temporaire de windows et de Notes

Messagepar Michael DELIQUE » 22 Juil 2005 à 14:03

Code : Tout sélectionner
Public Function GetDirectoryNotesTemp_API () As String
   
%REM
'variable API pour la fonction GetDirectoryWindowsTemp_API
Declare Function OSGetSystemTempDirectory Lib "nnotes" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
%END REM
   
   'Déclaration des Variables   
   Dim PathNotes As String
   Dim i As Integer
   
   On Error Goto ErreurGetDirectoryNotesTemp_API
   
   GetDirectoryNotesTemp_API = ""
   PathNotes = Space(256)
   i = OSGetSystemTempDirectory(PathNotes)
   GetDirectoryNotesTemp_API = Left$(PathNotes, i)
   
   Exit Function
ErreurGetDirectoryNotesTemp_API:
   Msgbox "("+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 !"
   GetDirectoryNotesTemp_API = ""
   Exit Function
End Function


Code : Tout sélectionner
Public Function GetDirectoryWindowsTemp_API () As String
   
%REM
'variable API pour la fonction GetDirectoryWindowsTemp_API
Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (Byval nBufferLength As Long, Byval lpBuffer As String) As Long
%END REM
   
   'Déclaration des Variables   
   Dim Directory As String * 512
   Dim nbDirectory As Integer
   
   On Error Goto ErreurHandle
   
   If GetTempPath(Len(Directory), Directory)<=0 Then
      GetDirectoryWindowsTemp_API  = ""
      Exit Function
   End If   
   
   nbDirectory = Instr(Directory, Chr(0))
   If nbDirectory>0 Then
      GetDirectoryWindowsTemp_API = Cstr(Left(Directory, nbDirectory-1))
   Else
      GetDirectoryWindowsTemp_API = Cstr(Directory)
   End If
   
   If Right(Trim(GetDirectoryWindowsTemp_API),1) <> "\" Then
      GetDirectoryWindowsTemp_API = GetDirectoryWindowsTemp_API+"\"
   End If
   
   Exit Function
ErreurHandle:
   Msgbox "("+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 !"
   GetDirectoryWindowsTemp_API = ""
   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
Avatar de l’utilisateur
Michael DELIQUE
Administrateur
Administrateur
 
Message(s) : 12183
Inscrit(e) le : 16 Déc 2004 à 10:36
Localisation : Paris/Cergy

Retour vers API

cron