I'm trying to use the WIN32API GetShortPathName() function to return the 8.3 version of a file name.
The code that I'm using is attached, SHORTPATHNAME.PRG.
When I try running this, as in
\long folder name\file.ext")
then I get an error message from the GetShortPathName() call, saying
Declare DLL call caused an exception.
Any suggestions as to what I'm doing wrong?
LOCAL lfShortName, lwReturn, lwShortName
DECLARE STRING GetShortPathName IN win32api AS GetShortPathName ;
STRING @fLong, STRING @fShort, INTEGER iLength
lfShortName = SPACE(255)
lwShortName = LEN(lfShortName)
* Call the function
lwReturn = GetShortPathName( @tfLongName, @lfShortName, lwShortName)
* Strip away unwanted characters
lfShortName = LEFT(lfShortName, lwReturn)
CLEAR DLLS GetShortPathName