4
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by ktsangop
0

well, I don't wanna program that will turn off pc, I wanna make program do something (execute code) when I will turn it off, like:

int main()
{
blablabla...
// things below happens when I will turn off my pc...
blablabla2...
}

Edited by senergy: n/a

0

I don't know about programatically (other than editing the registry) but you can use gpedit to schedule these types of things.

2

You can run your executable either at system shutdown or at user logoff using group policy editor. It works smoothly i use it all the time.

Type gpedit.msc at a command line prompt, and navigate either to :
computer settings-> windows settings -> scripts (startup / shutdown)
or
user settings-> windows settings -> scripts - >(logon / logoff)

There you can add a batch script or vbscript that simply executes your application.

If you application runs on the background and you want it to get notified when system is being terminated, then probably the only role of the script could be to notify your application (by p.e. writing something to a file).

Votes + Comments
nice!
good info :)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.