Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 854595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:56:53+00:00 2026-05-15T07:56:53+00:00

I am writing an application that runs in the background from startup to shutdown,

  • 0

I am writing an application that runs in the background from startup to shutdown, and in some circumstances I need the application to display a dialogue for the user to choose whether or not to continue shutting down. This application will only be running on Windows, but may be running on any version from 2000 onward.

While I have certainly done some research on the topic, the information regarding the way that windows handles application shut down (http://msdn.microsoft.com/en-us/library/ms700677(VS.85).aspx) seems to be a bit scattered. If anyone has an example of the best way to handle this, or additional knowledge regarding the topic, I would very much appreciate it (I have very little experience with C#).

Thanks!!

badPanda

Edit: I am aware that blocking shutdown is not considered to be good practice. It is a critical business requirement for this application.

Edit: On suggestion of the several commentators below (to redesign so that blocking shutdown is unnecessary), I have utilized a NotifyIcon Balloon popup to inform users not to shut down when the application is sending data. While this is not AS likely to prevent data from being held up on a local computer for weeks, I feel that it is a good compromise between the best practice and the business requirements. After all, if users will be stupid…well, users will be stupid.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:56:54+00:00Added an answer on May 15, 2026 at 7:56 am

    Well, the MSDN article you linked explains it clearly: you cannot prevent Windows from shutting down if your app is running on Vista or Win7. Prompting the user is not going to work, the dialog will be inaccessible. You will have to consider an app design that deals with this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an application that runs in background mode that can track user (so
I'm writing an application that needs to create a special user account hidden from
I'm writing an application that runs in the System Tray and notifies the user
So I'm writing a Spring web application that runs some scripts on the local
I'm writing a Windows application that basically runs in the background with a notification
I'm writing an application that runs things to a schedule. Idea being that the
I'm writing an application that runs as a system daemon (root session) for Mac
I am writing an application that allows a user to place images on a
I'm writing an application that gives the user the option to resize an image
I'm writing an application that will create difficult passwords for the user. The user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.