By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,949 Members | 1,345 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,949 IT Pros & Developers. It's quick & easy.

Run cleanup before the program is killed from the outside

P: n/a
Hi.

I have made a c++ program to be run on a computer (duh!). I set it to
be run with Windows Scheduler, and ticked the box saying: "Stop the
task if it runs for x hours and y minutes"

The program itself is running an infinite loop. My problem is that when
windows shuts it down, the program pops up with the "End Now?" dialog.
I would therefore like to do some last minute panic cleanup. So my
question is: is there a way for the c++ program to know it is about to
be shutdown from the outside? I only need to run one line of cleanup
code to make it all work

P.S.: I am aware that i might have posted to the wrong newsgroup, but i
think it is a generic c++ solution

Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ian
Is******@gmail.com wrote:
Hi.

I have made a c++ program to be run on a computer (duh!). I set it to
be run with Windows Scheduler, and ticked the box saying: "Stop the
task if it runs for x hours and y minutes"

The program itself is running an infinite loop. My problem is that when
windows shuts it down, the program pops up with the "End Now?" dialog.
I would therefore like to do some last minute panic cleanup. So my
question is: is there a way for the c++ program to know it is about to
be shutdown from the outside? I only need to run one line of cleanup
code to make it all work

P.S.: I am aware that i might have posted to the wrong newsgroup, but i
think it is a generic c++ solution


You have, how a process is terminated is OS specific.

Ian
Nov 22 '05 #2

P: n/a

Ian skrev:
Is******@gmail.com wrote:
Hi.

I have made a c++ program to be run on a computer (duh!). I set it to
be run with Windows Scheduler, and ticked the box saying: "Stop the
task if it runs for x hours and y minutes"

The program itself is running an infinite loop. My problem is that when
windows shuts it down, the program pops up with the "End Now?" dialog.
I would therefore like to do some last minute panic cleanup. So my
question is: is there a way for the c++ program to know it is about to
be shutdown from the outside? I only need to run one line of cleanup
code to make it all work

P.S.: I am aware that i might have posted to the wrong newsgroup, but i
think it is a generic c++ solution


You have, how a process is terminated is OS specific.

Ian

Okay, where should i then direct my question, please?

- Ishmagel

Nov 22 '05 #3

P: n/a

<Is******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Ian skrev:
Is******@gmail.com wrote:
> Hi.
>
> I have made a c++ program to be run on a computer (duh!). I set it to
> be run with Windows Scheduler, and ticked the box saying: "Stop the
> task if it runs for x hours and y minutes"
>
> The program itself is running an infinite loop. My problem is that when
> windows shuts it down, the program pops up with the "End Now?" dialog.
> I would therefore like to do some last minute panic cleanup. So my
> question is: is there a way for the c++ program to know it is about to
> be shutdown from the outside? I only need to run one line of cleanup
> code to make it all work
>
> P.S.: I am aware that i might have posted to the wrong newsgroup, but i
> think it is a generic c++ solution
>


You have, how a process is terminated is OS specific.

Ian

Okay, where should i then direct my question, please?


Many Windows experts answer questions about Windows at newsgroup
comp.os.ms-windows.programmer.win32

-Mike
Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.