As I see it u got 2 ways to solve this prb.
1. Use the high-precion-timer that follows with the OS, the multimedia timer.. to take the system clock( get next "tick"), which got alot of numbers something like 7836490734, and the next (tick) millisecond increments with 1, so you NEVER gonna get the number twice. If I remember it right it was a function called "GetNextTick()" in "mmci.dll".
2. I know there is a function in winapi that manages filenames for temporary filenames (I have NOT tested this).
Here is a tool the made my breakthrough,
API-Guide .
This tools giving you way to look some simple examples for most of windows API's
(I did use this tool in the days of windows 98, so I hope M$ havent f*** it up in XP

)