FILE_ATTRIBUTE_TEMPORARY simply tells Windows not to bother cachingwriting the file contents to disk if there's enough cache, because the file is temporary and no other process will be using it.
FILE_FLAG_DELETE_ON_CLOSE means just what it says - when you close the file it will be deleted automatically. This guarantees that it will be temporary.
GetTempFilename creates a name for a temporary file, and guarantees that the filename hasn't been used previously.
You should use all 3 methods when creating a temporary file. None of them interferes with the others.