Need help with GetShortPathName
I have used GetShortPathName frequently with no problem. However, now I'm having a problem.
In the past I have done, for example, @"C:\LongFoldername\LonfolderName\"
Now I'm us开发者_C百科ing UNC like this @"\\MyServerName\TheLongFolderName"
But it does not get shortened. It stays the same.
I have tried @"\\?\MyServerName\TheLongFolderName"
But that returns "".
I have read GetShortPathName Function But it did not help.
What am I missing?
Thanks!
I doubt very much that GetShortPathName will work on network names because they wouldn't be unique anymore and who would manage the mappings.
In a filesystem the short path name in guaranteed unique on the whole file system and it is created when the file with the long name is created or renamed. You cannot make ensure this in a network.
But even on a file system it is not guaranteed that a given file has a short file name, this may depend on system settings.
THe share name is too long - it must be under 11 chars for compability with GetShortPathName. I think you may be warned of this when creating long share names in some instances.
http://groups.google.co.uk/group/microsoft.public.win32.programmer.kernel/msg/88454e39076262ab
精彩评论