• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 445
  • Last Modified:

Disable or delay "End Program" box on shutdown Windows 7

a buddy of mine has a C++ program that starts on startup and runs in the background, that, on shutdown, halts shutdown and prompts the user with a question (in this case the question is "Have you signed out on the electronic in/out board?" If "yes" is selected then normal shutdown resumes. If "no" is selected, then a browser opens up to the in/out board on the intranet (it's a SharePoint page in Companyweb) where a user can then sign out.

The user will then have to initiate shutdown again, and will be prompted by the same question box as before.

This works awesome with one hitch. after initiating shutdown and the Box pops up to ask the user if they have signed out or not, after about 5 seconds, the "End Program" dialog box pops up (see attached. The "LogOffNotifier" in the title of the end program dialog box is the name of the C++ program, which initiates on a WM_Queryendsession).

This "end Program" dialog box is annoying and will confuse  users. Anyone know how to stop this from popping up, or at the very least, delay the time it takes to pop up to at least 30 seconds?

Thanks so much for taking a poke at this!
 thecode.txt
0
jriver12
Asked:
jriver12
1 Solution
 
sarabandeCommented:
you said the background program 'halts' the shutdown? how was that done?

is the background program and the program that shows up in the "End Program" box the same? if not, do you have the code of the program that shows up?

generally all applications getting a WM_QUERYENDSESSION message should return TRUE and wait for the WM_ENDSESSION to actually doing the cleanup stuff before closing.

if you don't return from handler of WM_QUERYENDSESSION, after 5 seconds windows shows up the popup you mentioned. if you would post a user message to your own window and return with FALSE, then the shutdown was canceled and you could do next action by handling the user message. as far as i know you could not change the delay time of 5 seconds (at least ms docs don't mention it).

but you can do some other thing in order to postpone shutdown if your app runs on vista or win 7. you could call ShutdownBlockReasonCreate and later when the shutdown should be proceed ShutdownBlockReasonDestroy.

see http://msdn.microsoft.com/en-us/library/aa376877(v=vs.85).aspx for details.

a good overview how you could handle shutdown changes in XP and Vista can be seen in

http://msdn.microsoft.com/en-us/library/bb394721(v=vs.85).aspx 

Sara

0
 
jriver12Author Commented:
thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now