Previous Topic: GetFileTime - Return File Creation Date, Last Access Date, or Last Modified DateNext Topic: GetShortFileName - Convert Long File Name to Short File Name


GetLongFileName - Convert Short File Name to Long File Name

Valid on Windows

The GetLongFileName function converts the short file name to the long file name.

This file content function has the format:

GetLongFileName(shortFileName as string, longFileName as string) as Boolean
shortFileName

This is an input parameter. It is the MS DOS 8.3 file name to be expanded into a long file name format.

longFileName

This is an output parameter and receives the long, expanded file name.

On successful execution, the function returns TRUE; otherwise, it returns FALSE. To convert a file name the related file must exist on the system or the function fails.

Example: GetFileStoreFree, GetFileStoreSize, and GetFileStoreUsage functions

This example converts a long file name into a short one and converts it back.

Dim lName, oName, sName As String
ClrScr()

oName ="c:\temp\a bb ccc dddd\abcdefghijklmnopqrstuvwxyz.txt"
If Not(GetShortFileName(oName, sName)) Then
	MessageBox("Can not convert to short", "DMS", MB_OK + MB_ICONEXCLAMATION)
	SetStatus(1)
	Exit
End If
Print( oName + " - " + sName)
If Not(GetLongFileName(sName, lName)) Then
	MessageBox("Can not convert to long", "DMS", MB_OK + MB_ICONEXCLAMATION)
	SetStatus(2)
	Exit
End If
Print( sName + " - " + lName)