472,791 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 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 3077
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
1
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
4
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
7
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
4
by: James Geurts | last post by:
Hi all, I'm trying to convert a string representing a path to Dos 8.3 notation. The code that I have works fine if the path exists, but it will not work if the path does not exist. I am looking...
3
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
3
by: Thom | last post by:
I'm trying to use shell to execute an old dos based program. This program takes a binary file and does internal processing and then outputs a text file based on the processing. I am choking on the...
1
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.