3

I need execute some code before Windows shutdown process each time. So, I want block Windows shutdown process for some time. How can i do it from Java or C++ Builder ?

Thanks.

Stan Kurilin
  • 15,614
  • 21
  • 81
  • 132
  • 3
    I don't know but you are not going to endear yourself to your users in the process – oxbow_lakes Mar 21 '10 at 13:20
  • 1
    Do you *need* to? Or is there a better way to have your program do things regularly, such as task scheduler or Windows Services? What are you trying to do? Can you expand upon your problem? –  Mar 21 '10 at 13:30
  • It's will be some logging system. – Stan Kurilin Mar 21 '10 at 13:40

2 Answers2

3

Use a logoff or shutdown script to launch an exe? This can be set by Group Policy.

Of course, I hope you have a good reason (like my corporate build) to do this. As mentioned in comments, what are you tring to do please?

gbn
  • 422,506
  • 82
  • 585
  • 676
0

See response on WM_POWERBROADCAST message. Also take into account that your ability to prevent shut down can depends on OS (it seems on Vista and later there are additional capabilities).

VitalyVal
  • 1,320
  • 12
  • 13