Konversi Long File Name menjadi Short File Name (VB6)
links: http://www.andreavb.com/tip030009.html

:: How to Convert Long File Name to Short File Name |
Author
|
David Costelloe |
Language
|
VB5, VB6 |
Operating Systems
|
Windows 95, 98 and NT |
API Declarations |
‘ API Declare
Private Declare Function GetShortPathName Lib “kernel32.dll” Alias “GetShortPathNameA” (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long |
Module |
Public Function ShortName(LongPath As String) As String
‘***************************************************************************
‘ Converts Long FileName to Short FileName
‘***************************************************************************
Dim ShortPath As String
Dim Ret As Long
Const MAX_PATH = 260
If LongPath = “” Then
Exit Function
End If
ShortPath = Space$(MAX_PATH)
Ret = GetShortPathName(LongPath, ShortPath, MAX_PATH)
If Ret Then
ShortName = Left$(ShortPath, Ret)
End If
End Function |
Usage |
‘Usage:
Private Sub Command1_Click()
MsgBox ShortName(“C:Program FilesMicrosoft Visual StudioLongexecutable.EXE”)
‘ Good for Shell uses or Name etc
End Sub |
Like this:
Like Loading...