您好,请问GetShortPathName函数在VB中如何使用呢?

我需要知道如何在vb中使用这个函数。例如,我现在用字符串A1获得了一个长路径,如何将这个A1变量的长路径转换为一个短路径,短路径用变量B1来表示。如何正确使用?

FFIVE
浏览 162回答 1
1回答

RISEBY

Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As LongPrivate Sub Command1_Click()Dim A1 As String, B1 As String, n As LongA1 = "C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSSOAP30.DLL"B1 = String(255, 0)n = GetShortPathName(A1, B1, 255)B1 = Left(B1, n)MsgBox B1End Sub
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript