Override win application confirmation messages over User Defined Apps


  1. Posts : 6
    Windows 10
       #1

    Override win application confirmation messages over User Defined Apps


    Hi i have a windows form application developed in c#. I will customize my windows image to have only this app running on boot up. I will also have a notepad app available for the user. I would like to know if there's any way i can override the save data pop up which will arise for the notepad if the user when he decides to shutdown.
    On the power button click by the user,I just want my user application to be saved, ignore the notification from notepad and a normal shutdown to happen.
    Kindly help.
      My Computer


  2. Posts : 12,801
    Windows 11 Pro
       #2

    Try an admin comand prompt and paste this in it and see if it will work. shutdown.exe /s /t 0 /f

    If it works you can make a .bat file of it and shutdown using it. Make sure you save everything you want to save before running it. I'm sure this isn't the solution you were looking for. But, if it works as a work around, maybe you could try it until you find the answers you want.
      My Computer


  3. Posts : 6
    Windows 10
    Thread Starter
       #3

    Hi, This really works. Thanks alot.
    Just wanted to know if it is possible in windows to run this script/batch file when the user presses the power button? Can that be configured anywhere in the settings?
    I dont want to run it from the command prompt. Or any existing settings available to disable the save as notification before the shutdown?
      My Computer


  4. Posts : 12,801
    Windows 11 Pro
       #4

    I'm really unsure what you want to do exactly, but see if this will help you. You can schedule a task to be run at certain points Import Task to Task Scheduler in Windows | Windows 10 Tutorials
      My Computer


  5. Posts : 6
    Windows 10
    Thread Starter
       #5

    Hi, Let me explain a bit more.
    Imagine you have an application like an ATM running on your PC and a notepad. ATM application is of priority here. The user may or may not use the notepad.
    Scenario 1: The ATM 'kind of' application is running, the user has written some data on the notepad file. Now the user presses the power button(hardware button). The PC should save any data of the ATM 'kind of' application, not show any SAVE AS notification for the notepad application and shutdown the system.
    Is this possible on windows 10.
    PS: the application ATM is just an example. :)
      My Computer


  6. Posts : 12,801
    Windows 11 Pro
       #6

    If there is a way to do it, I am not aware of it, perhaps @Brink is.
      My Computer


  7. Posts : 6
    Windows 10
    Thread Starter
       #7

    Oh, Hopefully he will be able to solve my doubts then...
    Thank you @essenbe, you were very quick. :)
      My Computer


  8. Posts : 68,881
    64-bit Windows 11 Pro for Workstations
       #8

    Hello Dipk11,

    I'm not aware of a way to have Windows have an application to automatically save itself when the power button is pressed. Normally, if a user shuts down or restarts with an unsaved file open, it'll cause a hang with a message for the user to go back and save their work first or continue to shut down or restart.

    I suppose you could set the default power button action to hibernate instead of shut down, so the computer will startup back to how it was before without losing anything. This of course will not help if the user presses and hold the power button for a hard shut down.

    Change Default Action of Power Button in Windows 10 | Windows 10 Tutorials

    It really is the responsibility of the user to make sure they have everything saved and closed before shutting down to be safe though.
      My Computers


  9. Posts : 2,450
    Windows 10 Pro x64
       #9

    Some applications, like Word, Excel etc, have an autosave option which is configurable (i.e how often to autosave). That's the closest soneone can get to autosave work before shutdown.
    As Shawn mentioned, it's the user's responsibility to save its work before shutdown.
      My Computer


  10. Posts : 6
    Windows 10
    Thread Starter
       #10

    Hi @Brink, Thank you for your reply.
    I just dont want to save the other applications unsaved data, hence i dont want the notifications/pop ups that come when i try to shut down.
    shutdown.exe /s /t 0 /f does the work but i want to execute this script on the power button press. This command directly shuts down without giving any warning to the user. There are ways where i can run this script in a batch file on the software shutdown. I do not wish to use the software shutdown button.
    I just want the power button available on the front panel connector of the PC to operate.
    Also the batch file doesnt run in the shutdown scripts option from gpedit.msc.
    I tried using the task scheduler, it works but theres no event for power button click.
    Can anybody actually help me in this?
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:30.
Find Us




Windows 10 Forums