例如把 
text1.text里的内容 C:\Program Files\Common Files\System 这个文件路径用VB转换为 C:\Progra~1\Common~1\System ,(Dos批处理只支持 8个字符的文件名字)然后返回给text2.text谢谢~急用!有没简洁点的方法~

解决方案 »

  1.   

    Option ExplicitPrivate Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As LongPublic Function GetShortPath(strFileName As String) As String
        Dim lngRes As Long, strPath As String
        strPath = String(256, 0)
        lngRes = GetShortPathName(strFileName, strPath, 255)
        GetShortPath = Left(strPath, lngRes)
    End FunctionPrivate Sub Form_Load()
        MsgBox GetShortPath("C:\Program Files\Common Files\System")
        End
    End Sub