Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C:\Progra~1

Status
Not open for further replies.

Pyramus

Programmer
Dec 19, 2001
237
GB
I am using GetModuleFileNameEx to get the paths to processes running on my machine.

It works fine for virtually everything, but the odd one or two comes out with the path using tildas. e.g. c:\progra~1\myfol~1\proc.exe

Does anyone know why for some files it does this? Is there a way to get the full path?
 
Is it possible that your nSize parameter is less than the path length on those occasions?

From the SDK

If the file name is longer than maximum number of characters specified by the nSize parameter, the file name is truncated.


-pete
 
GetModuleFileNamEx is an API, not a runtime function, so I don't think the age of the compiler has anything to do with it. However, if the problem remains you could always call the GetLongPathName API to convert 8.3 format to a long name.

Marcel
 
BTW, I guess in your shortcut, or in the registry, or in whatever else started the program, the program is started as c:\progra~1\...

Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top