Link to home
Start Free TrialLog in
Avatar of marcus78
marcus78

asked on

Long name from DOS short name

Hi - Say that I have a CString that contains a valid file name, but it uses the short name like "C:\progra~1\my~1.txt"

How can I get a CString that looks like:
1 - "C:\Program Files\My File.txt"

and (not required, but would be nice)

2 - "\\mymachine\c\Program Files\My File.txt"

My main target is NT4.0.

Any help would be great.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Crius
Crius

I think you have it backwards jkr. :) I believe marcus78 wants GetLongPathName() instead...
You are right :o)
Avatar of marcus78

ASKER

Crius, you're right I do want the long path, just haven't been able to try it out yet.  I'll get back to you and jkr later.
Crius, GetLongPathName() isn't supported in NT 4.0, so I couldn't use that.  Thanks for pointing it out though.

jkr, while GetShortPathName was the opposite of what I needed, it put me on the right track to end up using FindFirstFile.  I was able to use this to determine the long path in NT 4.0.  Thanks for your help!

Marcus