VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

GetShortFileName

Jan Nawara  (3 Submissions)   Files/File Controls/Input/Output   Visual Basic 3.0   Beginner   Wed 3rd February 2021

A short pathname of the passed string containing a long pathname.
'For example it turns "C:\Windows\MY Long Path Name\My Long Name File.txt" into "c:\windows\mylong~1\mylong~1.txt" (The actual resulting pathname is determined by the short names that windows assigns to all files and directories).
'This is useful when you need to create a fail proof pathname (assuming the file exists and is accesible).

Inputs
Requires that a pathname be passed.

Returns
A short DOS 8.3 format pathname.

API Declarations
Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

Rate GetShortFileName (1(1 Vote))
GetShortFileName.bas

GetShortFileName Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters