Le chemin cours (c:\progra~1\)

Le chemin cours (c:\progra~1\)

Messagepar Michael DELIQUE » 05 Nov 2007 à 17:44

converti un chemin long en chemin cours (dos)

Code : Tout sélectionner
Public Function GetShortPath_API(wPath As String) As String
%REM
'variableAPI pour la fonction GetShortPath_API
Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (Byval lpszLongPath As String, Byval lpszShortPath As String, Byval lBuffer As Long) As Long
%END REM
   
      'déclaration Variable
   Dim I As Long
   Dim Path As String
   
   On Error Goto ErreurGetShortPath_API
   
   GetShortPath_API = ""
   
   If Trim(wPath) = "" Then
      Exit Function
   End If
   
   Path = String$(165, 0)
   i = GetShortPathName(wPath, Path, 164)
   GetShortPath_API = Left$(Path, i)
   
   Path = ""
   
   Exit Function
ErreurGetShortPath_API:
   Msgbox "("+Cstr(Getthreadinfo(1))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+"."+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
GetShortPath_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