473,320 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 3100
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.