Article View: borland.public.cppbuilder.nativeapi
Article #13468Re: Short/Long pathname
From: Remy Lebeau (TeamB)
Date: Thu, 09 Oct 2003 20:26
Date: Thu, 09 Oct 2003 20:26
30 lines
2051 bytes
2051 bytes
"dude" <bendixdude@yahoo.com> wrote in message
news:3f85c1b4$1@newsgroups.borland.com...
> LPCTSTR lspFilename;
> LPTSTR spFilename;
> unsigned long buffer;
> ::GetShortPathName(lspFilename,spFilename,buffer);
You are not using GetShortPathName() correctly. You need to pass in a
pre-allocated buffer to accept the short filename, GetShortFileName() will
not allocate the buffer for you. It should be more like this instead:
TCHAR spFilename[MAX_PATH+1] = {0};
::GetShortPathName("the long file name here", spFilename,
sizeof(spFilename));
> This is to convert for the shellexecute command because
> that will bomb as well, given a long file name.
No, it will not bomb on LFNs. However, if you are concerned about it, you
could just pass the filename as part of the lpApplicationName parameter
instead of the lpCommandLine parameter, that way you can surround the
filename with extra quotation marks:
::ShellExecute(NULL , "open", "EXCEL.EXE \"the long file name here\"",
NULL, 0, SW_SHOW);
Gambit
Technical Details
Message-ID:
<3f85c3fc$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-05!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3f85c1b4$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,d208aa5f5b67a796 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-10-09 13:29:57 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f85c1b4$1@newsgroups.borland.com> Subject: Re: Short/Long pathname Date: Thu, 9 Oct 2003 13:26:20 -0700 Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 67.22.137.75 Message-ID: <3f85c3fc$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1065731068 67.22.137.75 (9 Oct 2003 13:24:28 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-05!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail