Solved

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

Posted on 2011-09-16
2
413 Views
Last Modified: 2012-05-12
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
Comment
Question by:jriver12
2 Comments
 
LVL 32

Accepted Solution

by:
sarabande earned 500 total points
ID: 36559883
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
 

Author Closing Comment

by:jriver12
ID: 36563328
thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now