Thread

DOS -> Win paths (Sdk)

DOS -> Win paths // Sdk

1  |  

hal9000

Dec 24, 2000, 5:12pm
does ANYONE know how to convert a DOS path (i.e. "C:\mydocu~1\somewh~1\") to
a windows path (i.e. "C:\My Documents\somewhere\")??????????
please VB or C++!!



--
-=Hal9000=- world:Discover
--==~~out~~==--

hal9000

Dec 24, 2000, 5:55pm
for all that care... I found out how to do this (in VB)



Public Function GetLongFilename _
(ByVal sShortName As String) _
As String

Dim sLongName As String
Dim sTemp As String
Dim iSlashPos As Integer

'Add \ to short name to prevent Instr from failing
sShortName = sShortName & "\"

'Start from 4 to ignore the "[Drive Letter]:\" characters
iSlashPos = InStr(4, sShortName, "\")

'Pull out each string between \ character for conversion
While iSlashPos
sTemp = Dir(Left$(sShortName, iSlashPos - 1), _
vbNormal + vbHidden + vbSystem + vbDirectory)
If sTemp = "" Then
'Error 52 - Bad File Name or Number
GetLongFilename = ""
Exit Function
End If
sLongName = sLongName & "\" & sTemp
iSlashPos = InStr(iSlashPos + 1, sShortName, "\")
Wend

'Prefix with the drive letter
GetLongFilename = Left$(sShortName, 2) & sLongName
End Function



--
-=Hal9000=- world:Discover
--==~~out~~==--
[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn