Récupérer le répertoire Temporaire (windows et lotus Notes)

Récupérer le répertoire Temporaire (windows et lotus Notes)

Messagepar Michael DELIQUE » 06 Nov 2007 à 09:00

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 ErreurGetDirectoryWindowsTemp_API
   
   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
   
   Exit Function
ErreurGetDirectoryWindowsTemp_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 !"
   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