Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

How to Convert Long File Name to Short File Name...

Total Hit ( 2931)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


API Declarations

Click here to copy the following block
' 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

Click here to copy the following block
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

Click here to copy the following block
'Usage:
Private Sub Command1_Click()
  MsgBox ShortName("C:\Program Files\Microsoft Visual Studio\Longexecutable.EXE")
  ' Good for Shell uses or Name etc
End Sub

Click here to copy the following block


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.