Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1450 connectés 

  FORUM HardWare.fr
  Programmation

  [VB] Transformer un pathname windows en pathname DOS (noms courts) ?

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[VB] Transformer un pathname windows en pathname DOS (noms courts) ?

n°26295
nix_
Posté le 20-04-2001 à 18:49:08  profilanswer
 

Comment transformer un pathname windows ( avec noms longs ) en pathname DOS (noms courts) avec les ~1 ?
Merci! ;)

mood
Publicité
Posté le 20-04-2001 à 18:49:08  profilanswer
 

n°26423
HelloWorld
Salut tout le monde!
Posté le 21-04-2001 à 23:52:51  profilanswer
 

Il me semble qu'il y a une API pour ca ...
ha ca y est, j'ai trouvé : GetShortFileName ...
 
voila : (dans un module) :
 
Private Declare Function GetShortPathName Lib "kernel32" _
   Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
   ByVal lpszShortPath As String, ByVal cchBuffer As Long) _
   As Long
 
Public Function GetShortFileName(ByVal FullPath As String) _
  As String
 
'PURPOSE: Returns DOS File Name (8.3 Format) Give
'FullPath for long file name
 
'PARAMETERS: FullPath: Full Path of Original File
 
'RETURNS: 8.3 FileName, or "" if FullPath doesn't
'         exist or file fails for other reasons
 
'EXAMPLE:  
'Debug.Print _
'  GetShortFileName("C:\My Documents\My Very Long File Name.doc" )
 
'If file exists, will display C:\MYDOCU~1\MYVERY~1.DOC
'in the debug window
 
Dim lAns As Long
Dim sAns As String
Dim iLen As Integer
   
On Error Resume Next
 
'this function doesn't work if the file doesn't exist
If Dir(FullPath) = "" Then Exit Function
 
sAns = Space(255)
lAns = GetShortPathName(FullPath, sAns, 255)
GetShortFileName = Left(sAns, lAns)
     
End Function
 
 
et donc NomCourt = GetShortFileName(NomLong)


---------------
FAQ fclc++ - FAQ C++ - C++ FAQ Lite
n°26752
nix_
Posté le 23-04-2001 à 17:38:59  profilanswer
 

Merci!  
J'essaye ca demain! ;)


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation

  [VB] Transformer un pathname windows en pathname DOS (noms courts) ?

 

Sujets relatifs
[ASP] transformer une chaine de caractères en tableau ??[Pascal] App DOS en plein écran !?
DOS , fichiers BATCH et parametres ...commande pour voir ce que lance windows au démarrage .
[C] les caracteres accentués dans une console DOSPersonne n'a des ennuis avec VC++6 et Windows 2000 ???
test clavier sous windows/DirectX8Comment transformer un prix en FRANCS -> EUROS (PHP)
autorun et plein ecran avec windows media playercommande net send sous windows
Plus de sujets relatifs à : [VB] Transformer un pathname windows en pathname DOS (noms courts) ?


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR