I have a set of local paths, and some of them are capitalized (C:\SOMEDIR\SOMEFILE.TXT). I need to convert them to their real names (as shown in Explorer). Suggest a way plz.
I suppose you could always use OpenFile
to get a handle, and then use the method here to get the filename from that handle. I haven't tried it, but it seems likely to give the "explorer name"
Obtaining a File Name From a File Handle
I don't know of any direct API call to do this in a single line.
Pass your file path to FindFirstFile
, the resulting WIN32_FIND_DATA.cFileName
will be in the correct case as read from the file system.
Are you looking for that: short names vs. long name?
Note that Explorer applies some tricky conversions to the file names. You easiest shot is to test it all and make your own function for the purpose.
Otherwise, you can try to access via OLE the Explorer's functions to list files in directory. But that is VERY painful and error prone to code. (Why I guess MS has given up in the end and provided the functions I have linked to above in Win2K).