[AccessD] Code to render ShortFileName

Arthur Fuller artful at rogers.com
Sun Mar 30 09:30:09 CST 2003


It seems to work well, but I think MS must have changed the rules since I
last looked:

? shortpath("e:\program files\microsoft sql server\mssql\data")
e:\PROGRA~1\MI6841~1\mssql\data


Not that I care; if it works, fine.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: March 29, 2003 5:40 PM
To: Arthur Fuller; accessd at databaseadvisors.com
Subject: Re: [AccessD] Code to render ShortFileName

Here's something I've just written (took all of 2 minutes):

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

Function ShortPath(Longpath As String)
	Dim strShortpath As String * 255
	Dim lngResult As Long
	lngResult = GetShortPathName(Longpath, strShortpath, 255) 
	ShortPath = strShortpath 
End Function





More information about the AccessD mailing list