locked
Windows/Desktop Application should run as background RRS feed

  • Question

  • I made a window application in visual studio.. In that window application i saved some data in app.config file.. But after installing that setup file.. and when i open and then close that window application the data loss and process kill from task manager..
    Any idea how to run my window application as background so that it should run all the time even after the system restarts??

    Thanks

    Wednesday, September 18, 2013 9:15 AM

All replies

  • Hi,

    In Windows, there is a Registry - "regedit.exe"  which starts and runs any programs specified in a registry node\key every reboot\restart the location is:

    <kbd style="color:#600030;">HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\</kbd>

    Add your software, here to persist after reboot, and this would run-again after the next reboot. If error, shows when trying to add into the location, it could be due to Access Control Lists (ACL's \ DACLS), if so you can either create a ACE to remove the ACL's\DACLS , or you can elevate then retry the adding process.

    Idea 2:  

    If your Software already has the Administrative privileges, you can add it to the System32 folder located in:

    <kbd style="color:#600030;">C:\Windows\System32</kbd>

    It will also persist, but with a additional advantage, it will reboot as Administrator every reboot. If you are working on Vista+ Operating System you can always use the UAC (User Account Control), either by adding it to your Software Manifest or performing a Run-Time Elevation, a tutorial is available in Code Project, which shows how to use that: 

    http://www.codeproject.com/Articles/320748/Haephrati-Elevating-during-runtime

    This would be not only more dynamic in sense that you can call the function whenever you need Administrator Privileges, and make it less "sketchy".

    Regards 

    Rohan

    • Proposed as answer by RRohanR Tuesday, October 1, 2013 3:10 PM
    Saturday, September 21, 2013 6:15 PM