You are here

Scheduling file delation

1 post / 0 new
m2
Offline
Last seen: 11 years 9 months ago
Joined: 2006-12-12 12:00
Scheduling file delation

My starter:
1. Creates a temporary file
2. Starts the application
3. Quits

The file is in use as long as the app is alive and a while longer.
Then I'd like to delete it.

Does the winapi task scheduling work on VERY limited accounts?
I haven't checked too carefully, because I doubt it does.
I tried
CreateFile( filePath, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0);

before starting the app, but it didn't work.

This project is somehow specific, because I can execute almost any code in this while after the application quit...but the file will be opened as long as I do something.

The only solution I found is running the starter with a special parameter - it'd wait until the file is free and then delete it. But I'd rather use something better...Any ideas?