我需要知道如何在vb中使用这个函数。例如,我现在用字符串A1获得了一个长路径,如何将这个A1变量的长路径转换为一个短路径,短路径用变量B1来表示。如何正确使用?
1 回答
RISEBY
TA贡献1856条经验 获得超5个赞
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Sub Command1_Click()
Dim A1 As String, B1 As String, n As Long
A1 = "C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSSOAP30.DLL"
B1 = String(255, 0)
n = GetShortPathName(A1, B1, 255)
B1 = Left(B1, n)
MsgBox B1
End Sub
添加回答
举报
0/150
提交
取消