You could spawn a thread that waits for the process to end (WaitForSingleObject on the process handle or something like that), at which point you delete the file. Of course, this only applies if the program quits after finishing with the file.
How about if you spawn the process, Sleep() for a second or two (to make sure the default viewer has opened the file), then poll the file once in a while?
Code:
ThreadProc:
Sleep(1500);
std::ifstream file("temp.tmp");
while(!file)
{
Sleep(500);
file.clear();
file.open("temp.tmp");
}
file.close();
DeleteFile(...); // or whatever
return 0;