Visual Basic > Files Directories Drives
Getting the Short Filename
Getting the Short Filename Declare Function GetShortPathName Lib "kernel32" _ Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long Public Function GetShortName(ByVal Filename As String) As String 'Dimension some variables. Dim lRetVal As Long Dim sShortPathName As String Dim iLen As Integer 'Set up buffer area for API function call return sShortPathName = Space(20) iLen = Len(sShortPathName) 'Call the function lRetVal = GetShortPathName(Filename, sShortPathName, iLen) 'Strip away unwanted characters. GetShortName Left(sShortPathName, lRetVal) End Function
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows