Thanks Ian, but slight misunderstanding I think, probably my fault for not giving an example.
I need to get the DOS filename ("Myfile~1.txt") for a given long file name ("My file with a long name.txt")
Unfortunately it can't be directly derived from the long file name alone, because if you have two similarly named files, Windows will name one of them "Myfile~2.txt", usually this is the more recently created of the two, but I don't think that's a rock-solid rule.