| Visual Basic Code |
| Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" ( ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, ByVal cchBuffer As Long ) As Long Private Sub Form_Load ( ) MsgBox GetDOSPath ( "C:/Documents And Settings/Administrator/桌面" ) End Sub Private Function GetDOSPath ( WinPath As String ) As String Dim DosPath As String Dim DosPathSize As Long DosPathSize = GetShortPathName ( WinPath, vbNullString, 0 ) DosPath = String ( DosPathSize, " " ) GetShortPathName WinPath, DosPath, DosPathSize GetDOSPath = DosPath End Function |
VB取得DOS方式的路径地址
最新推荐文章于 2021-09-28 21:25:16 发布
本文提供了一段使用Visual Basic编写的代码示例,该代码通过调用Windows API函数GetShortPathName来获取文件系统的短路径名。短路径名在处理长路径或兼容旧版应用程序时非常有用。
1553

被折叠的 条评论
为什么被折叠?



