Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer

Status
Not open for further replies.

skiflyer

Programmer
Sep 24, 2002
2,213
0
0
US
Alright, so I've written a nice little program... it downloads things in the background with throttled bandwidth, and everyone's happy.

It as a resume function, and it checks the state of the download tying everything up when it's done.

So my problem... the program executes straight through, and if the download isn't done when it exits it doesn't tie everything up... the download still keeps working (hopefully still in the throttled state, I haven't tested this yet)... then when it's called again through it's resume link, it notices the state and finishes everything up.

Now, I have a working COM callback in there, such that it notifies the program when the download is done and closes things, but the program never stays alive long enough for this to kick in (I know it works because during debug mode the download does finish)... alternatively, I've written a little checkState function which does the same thing manually, and which probably will need to be called no matter what do to the fact that it calls some support functions to clean up things on disk and such.

Ok, so my question is how to keep my program living, probably with a timer, without chewing up too many clock cycles?

Or, if it's a separate issue, how to keep it living while waiting for a comCallBack? I'll take any answer, be it the elegant wait for an event one, or just a timer which checks my function every so often inserted at the end of the program.

Currently the program executes in a dos window, eventually I want to move it to a systray icon... I don't know if that matters, but in case it does.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top