Hello Dr. GUI!
I read about your T-shirt prize for the questions selected by you. I am mailing this to you with a hope of getting my doubt cleared and getting a T-shirt from you.
I have a question about long and short filenames.
Can I assign my own value to the long file name without allowing the operating system to assign its own value while creating a new file? Can I change the long file name and short file name for an existing file? For example:
What I want is, the long file name may be "LONGTESTFILENAME.DOC" and the corresponding short file name should be "FILE1.DOC".
What the operating system might do is, the long file name is "LONGTESTFILENAME.DOC" and the short file name is "LONGTE~1.DOC".
If yes, how can I do it?
I hope the question is clear to you.
Regards,
Velan A. Senthil
Dr. GUI replies:
Even with modern medicine, there are some problems Dr. GUI can't solve—and this is one of them. Thankfully, our inability to cure this condition won't be fatal to the patient.
The short file name (SFN) is generated by the operating system and there is no way to change its algorithm nor to assign your own SFN.
This isn't what you wanted, but you can turn off short file name generation altogether by editing a registry key. This can lead to increased directory enumeration performance. For more information see "How to Disable the 8.3 Name Creation on NTFS Partitions" (MSDN Library, Knowledge Base article Q12100). The good doctor normally doesn't recommend this, since turning off short file names will prevent 16-bit Windows and MS-DOS programs from accessing files with long names.
Your shirt is in the mail.