Home All Groups Group Topic Archive Search About

How to convert ShortPath to longPath?

Author
9 Jul 2006 11:38 AM
yxq
Hello,
How to convert "c:\PROGRA~1" to "c:\program files"

Thank you

Author
9 Jul 2006 1:14 PM
Göran_Andersson
There is a GetLongPathName method in kernel32.dll that does that.

I found this article, that has a code sample:

http://www.c-sharpcorner.com/UploadFile/crajesh1981/RajeshPage103142006044841AM/RajeshPage1.aspx?ArticleID=63e02c1f-761f-44ab-90dd-8d2348b8c6d2


yxq wrote:
Show quoteHide quote
> Hello,
> How to convert "c:\PROGRA~1" to "c:\program files"
>
> Thank you
>
>
Author
9 Jul 2006 1:22 PM
Theo Verweij
Maybe this will help:

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=b310d797-bdb2-4726-a0f0-ec44baa2ac66

yxq wrote:
Show quoteHide quote
> Hello,
> How to convert "c:\PROGRA~1" to "c:\program files"
>
> Thank you
>
>
Author
9 Jul 2006 3:29 PM
Dennis
Declare Auto Function GetLongPathName Lib "kernel32.dll" _
(ByVal lpszShortPath as string, ByVal lpszLongPath as stringbuilder, ByVal
cchBuffer as integer) _
as Integer
Public Function ToLongPathName (shortName as String) as String
    Dim longNameBuffer as New StringBuilder(256)
    Dim BufferSize as Integer = longNameBuffer.Capacity
    GetLongPathName(shortName, longNameBuffer, bufferSize)
    Return longNameBuffer.ToString()
End Function

--
Dennis in Houston


Show quoteHide quote
"yxq" wrote:

> Hello,
> How to convert "c:\PROGRA~1" to "c:\program files"
>
> Thank you
>
>
>
Author
9 Jul 2006 11:10 PM
yxq
Thank you very much.

Show quoteHide quote
"Dennis" <Den***@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:2FCEE87C-25FC-4C55-9EA3-0B8B74801***@microsoft.com...
> Declare Auto Function GetLongPathName Lib "kernel32.dll" _
> (ByVal lpszShortPath as string, ByVal lpszLongPath as stringbuilder, ByVal
> cchBuffer as integer) _
> as Integer
> Public Function ToLongPathName (shortName as String) as String
>    Dim longNameBuffer as New StringBuilder(256)
>    Dim BufferSize as Integer = longNameBuffer.Capacity
>    GetLongPathName(shortName, longNameBuffer, bufferSize)
>    Return longNameBuffer.ToString()
> End Function
>
> --
> Dennis in Houston
>
>
> "yxq" wrote:
>
>> Hello,
>> How to convert "c:\PROGRA~1" to "c:\program files"
>>
>> Thank you
>>
>>
>>