Chemin DOS

cs_Xime Messages postés 75 Date d'inscription lundi 4 février 2002 Statut Membre Dernière intervention 24 mars 2003 - 7 août 2002 à 10:23
clementio Messages postés 432 Date d'inscription samedi 18 mai 2002 Statut Membre Dernière intervention 17 février 2014 - 7 août 2002 à 11:46
salut

j'aimerais savoir comment recuperer le chemin MS-DOS d'un fichier

merci

1 réponse

clementio Messages postés 432 Date d'inscription samedi 18 mai 2002 Statut Membre Dernière intervention 17 février 2014 1
7 août 2002 à 11:46
Voici un exemple tiré de l'API-Guide:

Déclaration de l'API:

Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long

Ecriture de la fonction:

Public Function GetShortPath(strFileName As String) As String
Dim lngRes As Long, strPath As String
strPath = String$(165, 0)
lngRes = GetShortPathName(strFileName, strPath, 164)
GetShortPath = Left$(strPath, lngRes)
End Function

Appel de la fonction:

Private Sub Form_Load()
MsgBox GetShortPath("c:\Program Files")
End Sub

Et voilà,

A+, Clm
0
Rejoignez-nous