Help, need API to get short filenames (such as: c:\progra~1\bla.txt) 
Author Message
 Help, need API to get short filenames (such as: c:\progra~1\bla.txt)

Hi there,
can anyone tell me if there is a windows API (or Visual Basic commando) to
recieve the short path and filename.
so I need an API wich I give for example:
    c:\program files\filenamelong.txt
end then returns:
    c:\progra~1\filena~1.txt

I need such a windows API, because the CopyFile API requirs short
names....or I'm not using this API correctly.

So, can anyone tell me either what I'm doing wrong when using the CopyFile
API or tell me if there is a way to recieve the short filename format...




Mon, 27 Aug 2001 03:00:00 GMT  
 Help, need API to get short filenames (such as: c:\progra~1\bla.txt)

Quote:

> Hi there,
> can anyone tell me if there is a windows API (or visual basic commando) to
> recieve the short path and filename.
> so I need an API wich I give for example:
>     c:\program files\filenamelong.txt
> end then returns:
>     c:\progra~1\filena~1.txt

This is blatently and anti-socially off-topic in
alt.comp.lang.learn.c-c++, and deserves to be roundly flamed.  But this
is so silly as to deserve an answer.
Question:
  How do I get A short path name?
Answer:
  GetShortPathName().

Geez.

--




Mon, 27 Aug 2001 03:00:00 GMT  
 Help, need API to get short filenames (such as: c:\progra~1\bla.txt)


Quote:
>Hi there,
>can anyone tell me if there is a windows API (or visual basic commando) to
>recieve the short path and filename.
>so I need an API wich I give for example:
>    c:\program files\filenamelong.txt
>end then returns:
>    c:\progra~1\filena~1.txt

GetShortPathName

Chris
-----------------------------------------------------------------------

Visit our web site at http://www.skymap.com
Astronomy software written by astronomers, for astronomers



Mon, 27 Aug 2001 03:00:00 GMT  
 Help, need API to get short filenames (such as: c:\progra~1\bla.txt)


Quote:

>But this is so silly as to deserve an answer.
>Question:
>  How do I get A short path name?
>Answer:
>  GetShortPathName().

No question about programming is silly ... what if he's a newbie ??
We've all been there, and probably had a whole bunch of so-called
silly questions ...

Calling it a silly question is like telling him he's dumb or doesn't know
anything about programming ...

- Thomas Daugaard

Quote:
>Geez.

>--





Tue, 28 Aug 2001 03:00:00 GMT  
 Help, need API to get short filenames (such as: c:\progra~1\bla.txt)
The only thing anti-social around here is not off topic posts but your arrogance.

--

Loose cannon on deck!

aka wozza

tpfkaw
from the poster formerly known as wozza

http://www.ecn.net.au/~wozza/crackz

Quote:


>> Hi there,
>> can anyone tell me if there is a windows API (or visual basic commando) to
>> recieve the short path and filename.
>> so I need an API wich I give for example:
>>     c:\program files\filenamelong.txt
>> end then returns:
>>     c:\progra~1\filena~1.txt

>This is blatently and anti-socially off-topic in
>alt.comp.lang.learn.c-c++, and deserves to be roundly flamed.  But this
>is so silly as to deserve an answer.
>Question:
>  How do I get A short path name?
>Answer:
>  GetShortPathName().

>Geez.

>--





Wed, 12 Sep 2001 03:00:00 GMT  
 Help, need API to get short filenames (such as: c:\progra~1\bla.txt)
Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" _
(ByVal lpszLongPath As_ String, ByVal lpszShortPath As String, ByVal
cchBuffer As Long) As Long

 Function ShortName(lpszLongPath As String) As String
   Dim lpszShortPath As String
   Dim cchBuffer As Long
   Dim lngRet As Long

   lpszLongPath = lpszLongPath
   lpszShortPath = String$(255, 0)
   cchBuffer = Len(lpszShortPath)

   lngRet = GetShortPathName(lpszLongPath, lpszShortPath, cchBuffer)
   If lngRet > cchBuffer Then
     lpszShortPath = String$(lngRet, 0)
     cchBuffer = Len(lpszShortPath)
     lngRet = GetShortPathName(lpszLongPath, lpszShortPath, cchBuffer)
   End If
   ShortName = Left(lpszShortPath, lngRet)
 End Function

--
Tom Lake
ICQ #25589135



Fri, 14 Sep 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Help, need API to get short filenames (such as: c:\progra~1\bla.txt)

2. Help, need API to get short filenames (such as: c:\progra~1\bla.txt)

3. n=d%*d% NO, bla=d% n=bla*bla YES, beginners question

4. Multiple-step OLE DB operation bla bla bla...

5. Need to get the short filename from a long filename

6. Getting short filename

7. Getting Short Filename

8. Getting short filenames in VB 4?

9. getting short ms-dos filename with vb4-32

10. Getting short file names instead of long filenames?

11. Converting a Long FIleName to it's short equivalent (Both possible shorts)

12. bla bla test sheep

 

 
Powered by phpBB® Forum Software