In DOS operating systems, filenames were limited to 8 characters and extensions were limited to 3 characters. Some API functions require filenames in this format. A long filename can be converted to a short filename with GetShortPathNameA
filedialog"Open","*.*",file$
if file$=""thenend'use function with null short name argument'first to determine size of buffer neededcalldll#kernel32,"GetShortPathNameA",_
file$ asptr,_ 'long filename
_NULL aslong,_ 'short filename argument, null to get length of buffer0aslong,_ 'length of buffer, null to get length of buffer
length asulong'required length of buffer'create a string buffer of the correct length:
shortfile$=space$(length)+chr$(0)calldll#kernel32,"GetShortPathNameA",_
file$ asptr,_ 'long filename
shortfile$ asptr,_ 'short filename
length aslong,_ 'length of buffer
result asulongprint"Long filename is "; file$
print"Length of buffer for short filename is ";length
print"Short filename is ";shortfile$
GetShortPathNameA
-GetShortPathNameA | DOS 8.3 Filenames | Demo
DOS 8.3 Filenames
In DOS operating systems, filenames were limited to 8 characters and extensions were limited to 3 characters. Some API functions require filenames in this format. A long filename can be converted to a short filename with GetShortPathNameATo learn more about 8.3 filenames:
8.3 Filenames at Wikipedia
Demo
GetShortPathNameA | DOS 8.3 Filenames | Demo