Find the letter of drive by his name [Resolved]
Posted: Sat Apr 20, 2024 8:49 pm
Hello at all
I know how find the name of a drive when i have his letter
But i don't know the oposite
Then, with the first code, i have create a function who works fine, but have you the direct API for replace my dirty code with enumeration of all drives
Have a good day
I know how find the name of a drive when i have his letter
Code: Select all
Procedure.s Lecteur_LettreEnNom(LettreLecteur.s)
sVolumeNameBuffer.s = Space(#MAX_PATH)
lpVolumeNameBuffer.l = @sVolumeNameBuffer
nVolumeNameSize.l = #MAX_PATH
GetVolumeInformation_(@LettreLecteur, lpVolumeNameBuffer, nVolumeNameSize, 0, 0, 0, 0, 0)
ProcedureReturn sVolumeNameBuffer
EndProcedure
Debug Lecteur_LettreEnNom("C:\")Then, with the first code, i have create a function who works fine, but have you the direct API for replace my dirty code with enumeration of all drives
Code: Select all
Procedure.s Lecteur_NomEnLettre(NomLecteur.s)
drives_avail = GetLogicalDrives_()
sVolumeNameBuffer.s = Space(#MAX_PATH)
nVolumeNameSize.l = #MAX_PATH
For i = 0 To 25
If drives_avail >> i & 1
LettreLecteur$ = Chr(i + 65) + ":\"
lpVolumeNameBuffer.l = @sVolumeNameBuffer
GetVolumeInformation_(@LettreLecteur$, lpVolumeNameBuffer, nVolumeNameSize, 0, 0, 0, 0, 0)
If NomLecteur = sVolumeNameBuffer
ProcedureReturn LettreLecteur$
EndIf
EndIf
Next
EndProcedure
Debug Lecteur_NomEnLettre("Windows")
