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
jriver12Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jriver12Author Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.