Page 1 sur 1

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

MessagePublié: 06 Nov 2007 à 09:00
par Michael DELIQUE
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