Solved

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

Posted on 2011-09-16
2
427 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 33

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 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