cs_jack9911
Messages postés5Date d'inscriptionmercredi 29 mai 2002StatutMembreDernière intervention22 juin 2003
-
22 juin 2003 à 15:02
cs_jack9911
Messages postés5Date d'inscriptionmercredi 29 mai 2002StatutMembreDernière intervention22 juin 2003
-
22 juin 2003 à 15:49
voila, en utulisant une boite de dialoge, le client selectione un fichier dont le chemin est saufgardé
maintenant il me faudra changé se chemin en chemin dos le plus facilement posible
quelquun aurai une idee svp?
cs_jack9911
Messages postés5Date d'inscriptionmercredi 29 mai 2002StatutMembreDernière intervention22 juin 2003 22 juin 2003 à 15:16
merci de ta reponse mais je suis un débutant...
et euh? je ne sais pas comment faire ce que tu me dis :/
tu peux me dire comment je peux apliqué ca ici decu stp?
Private Sub Command4_Click()
Dim Filtre, LeFichier
'Initialisations
Dlg.CancelError = True
Dlg.DialogTitle = "Ouvrir un fichier texte"
Dlg.FileName = "*.txt"
Filtre = "Textes (*.txt)|*.txt|Informations (*.moi;*.me)|"
Filtre = Filtre + "*.moi;*.me|Tous les fichiers (*.*)|*.*"
Dlg.Filter = Filtre
Dlg.Flags = cdlOFNFileMustExist Or cdlOFNPathMustExist
'Appel de la boîte Ouvrir
On Error Resume Next
Dlg.ShowOpen
'Retour
If Err <> cdlCancel Then
Me.Caption = Dlg.FileTitle
LeFichier = Dlg.FileName
Open LeFichier For Input As #1
If Err Then
MsgBox "Impossible d'ouvrir le fichier: " + LeFichier
Exit Sub
End If
'Transforme le pointeur de la souris en sablier.
Screen.MousePointer = 11
'Affiche le nouveau texte.
Text1.Text = LeFichier
Close #1
'Réinitialise le pointeur de la souris.
Screen.MousePointer = 0
End If
On Error GoTo 0
End Sub
cs_rene38
Messages postés1858Date d'inscriptionsamedi 29 juin 2002StatutMembreDernière intervention17 octobre 201311 22 juin 2003 à 15:26
Dans la section Général - Déclarations :
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long
La fonction :
Public Function CheminDOS(CheminWin As String) As String
Dim Longueur As Long, Chemin As String
Chemin = String$(165, 0)
Longueur = GetShortPathName(CheminWin, Chemin, 164)
CheminDOS = Left$(Chemin, Longueur)
End Function
------------------------------------------------
Ton code :
...............
LeFichier = Dlg.FileName
'et tu ajoutes :
LeFichierDOS = CheminDOS(LeFichier)
...............