471,049 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,049 software developers and data experts.

How to convert ShortPath to longPath?

yxq
Hello,
How to convert "c:\PROGRA~1" to "c:\program files"

Thank you
Jul 9 '06 #1
4 3003
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/UploadF...d-8d2348b8c6d2
yxq wrote:
Hello,
How to convert "c:\PROGRA~1" to "c:\program files"

Thank you

Jul 9 '06 #2
Maybe this will help:

http://www.gotdotnet.com/Community/U...0-ec44baa2ac66

yxq wrote:
Hello,
How to convert "c:\PROGRA~1" to "c:\program files"

Thank you

Jul 9 '06 #3
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
Jul 9 '06 #4
yxq
Thank you very much.

"Dennis" <De****@discussions.microsoft.com写入消息新闻:2F** ********************************@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

Jul 9 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by Lauren Quantrell | last post: by
1 post views Thread by Logan X via .NET 247 | last post: by
4 posts views Thread by James Geurts | last post: by
3 posts views Thread by Convert TextBox.Text to Int32 Problem | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.