hello all. first time poster and relatively new to serious c/c++ programming. I'm looking for the best way to accomplish the following:

I have to create a background process that will periodically check some system settings. one key is that the app has to respond to a windows logoff/shutdown message from the OS so that it can do some final work (especially kill the timer that it set up).

because the app has to remain responsive to this endsession message, using a call to Sleep() won't work, as the program is unresponsive during said call.

i have chosen to set and use timers, but i don't know how to start a windowless (ie no GUI) program that will load up and then just sit there (after registering a timer that will call back to the program at a prescribed interval).

if i try this (pseudocode for brevity):

Code:
main() {
    timer = setTimer(NULL,(int)NULL,60000,TIMERPROC(&timerFx));
}
i don't know how to have this program just sit idle without the main function exiting the app terminating.

is there a way to create a non-GUI app that will load and then just keep running but doing nothing until the timer fires? this app is supposed to be as small and fast as possible, so i'm trying to eliminate the GUI if i can, since it will never be shown anyway.

thank you for any input.