I've got some code running as a background process, implemented in VB6. I'd like it to take some action once a day, say at 02:00 local time; it then simply sleeps until the next appropriate time unless something causes it to quit in the meantime.
I've tried using the Win32 Sleep() call, but this blocks the entire thread and the app won't shut down tidily. The app should display no user interface; the idea is to run it as a service that cannot interact with the desktop as it must run as a non-system user identity. So I'm not inclined to use a timer control. I'm not sure about ccrpTimer either, as it appears to call back to th timed function on a different thread to the main thread.
Anyone got any suggestions as to how I can do this?