Solved

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

Posted on 2011-09-16
2
433 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 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