Board index » delphi » Long filename to 8.3 filename??

Long filename to 8.3 filename??

How do you convert a long filename to a short filename (pref in Delphi 1), but a delphi 2 answer would be some use.  Thanks in advance.

--

 Warren Young
The University of Edinburgh

 

Re:Long filename to 8.3 filename??


In article <52u08v$...@scotsman.ed.ac.uk>, w...@ee.ed.ac.uk says...

Quote

>How do you convert a long filename to a short filename (pref in Delphi 1), but
a
> delphi 2 answer would be some use.  Thanks in advance.

>--

> Warren Young
>The University of Edinburgh

Delphi 2.00:
GETSHORTPATHNAME(longpath,shortpath,buffersize)

--
Ash
CrashCourse Software
www.theknow.com/CrashCourse/CrashCourse.htm

Re:Long filename to 8.3 filename??


Delphi 1 doesn't have access to long file names, unless you are thunking up
to the Win32 API.  Win16 programs will automatically use 8.3.  However, in
D2 use the GetShortPath name API to retrieve the short version of a long
path.

--
Mark Pritchard
-------------
http://www.ozemail.com.au/~pritchma

Warren F Young <w...@ee.ed.ac.uk> wrote in article
<52u08v$...@scotsman.ed.ac.uk>...

Quote
> How do you convert a long filename to a short filename (pref in Delphi

1), but a delphi 2 answer would be some use.  Thanks in advance.

Re:Long filename to 8.3 filename??


On 3 Oct 1996 05:04:46 GMT, "Mark Pritchard" <pritc...@ozemail.com.au>
wrote:

Quote
>Delphi 1 doesn't have access to long file names, unless you are thunking up
>to the Win32 API.  Win16 programs will automatically use 8.3.  However, in
>D2 use the GetShortPath name API to retrieve the short version of a long
>path.

In D1 it's probably easier to use the DOS lfn services, along with
dos3call.  I haven't tried this though.

Duncan Murdoch

Re:Long filename to 8.3 filename??


w...@ee.ed.ac.uk (Warren F Young) wrote:

Quote
>How do you convert a long filename to a short filename (pref in Delphi 1), but a delphi 2 answer would be some use.  Thanks in advance.
>--
> Warren Young
>The University of Edinburgh

Here's a well-tested C function that will do it under Win3.1. Simply
convert it to use in line asm statements in Delphi 1, and you should
be all set.

//*************************************************************************
// Convert a long filename under Win95, to a short Filename...
//      Returns TRUE on success, else FALSE.
//***************************
BOOL LongtoShort(LPSTR lpLongName, LPSTR lpShortName)
{

        asm {
                lds     si, DWORD PTR lpLongName
                les     di, DWORD PTR lpShortName
                mov    ax, 7160h
                mov     cl,1    // Get short path name
                mov     ch,0    // return full path, not subst
                int     21h
                jc              error
        }
                return TRUE;
error:
                return FALSE;

Quote
}

I haven't looked at converting it, but if you do, please email it back
to me. It will same me some time.
Thanks.

David Block
CoStar Corporation

Other Threads