Post by David FordI'm trying to use the mciSendString command, and I don't think it likes the
verbose directory and file naming conventions in Windows. How can I get the
condensed path name as in the subject line?
Thanks.
David --
Here's what I use. Watch for word wrapping.
Private Declare Function GetShortPathName Lib "kernel32" _
Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Long) As Long
Public Function ShortPathName(ByVal strPath As String) As String
'--------------------------------------------------------------
' Procedure : ShortPathName
' DateTime : 6/3/01 09:51
' Author : Edgar
' Purpose : Returns a short path (DOS) name from a valid path.
'--------------------------------------------------------------
Const MAX_PATH = 255
Dim strBuff As String
Dim lngRet As Long
Dim strRet As String
On Error GoTo ShortPathName_Error
If ((DirExists(strPath)) Or (FileExists(strPath))) Then
strBuff = Space$(MAX_PATH)
lngRet = GetShortPathName(strPath, strBuff, Len(strBuff))
strRet = Left$(strBuff, lngRet)
End If
ShortPathName_Exit:
ShortPathName = strRet
Exit Function
ShortPathName_Error:
strRet = ""
Err.Clear
Resume ShortPathName_Exit
End Function
Jim Edgar