473,473 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I make the windows application run automatically

375 Contributor
Hi All,

I have a Windows application that should run 24*7, I scheduled the task and gave run when system starts, neither did it pop the windows screen, or did it run. I could not see the windows application in the Process panel of the Task Manager.
But later I deleted the scheduled task and gave Run and specified the timings too.
The application ran successfully.

Where am I going wrong?. Apart from scheduling a task is there any other way of running an windows application automatically without manual intervention (excluding windows service)

Thnx in advance.

Regards
cmrhema
Mar 10 '09 #1
5 2166
PRR
750 Recognized Expert Contributor
As yours is a windows application you can use the following code to put your application to run on start up....

Expand|Select|Wrap|Line Numbers
  1. public static void SetAtStartUp()
  2.         {
  3.             RegistryKey startUpKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
  4.             try
  5.             {
  6.  
  7.                 if (startUpKey.GetValue("YourKeyName") == null)
  8.                 {
  9.                     startUpKey.SetValue("YourKeyName", Convert.ToString(Application.ExecutablePath));
  10.                 }
  11.  
  12.                 else
  13.                 {
  14.                     object o = startUpKey.GetValue("YourKeyName");
  15.  
  16.                     if (o.ToString() != Convert.ToString(Application.ExecutablePath))
  17.                     {
  18.                         startUpKey.SetValue("YourKeyName", Convert.ToString(Application.ExecutablePath));
  19.                     }
  20.                 }
  21.             }
  22.  
  23.             catch (Exception ex)
  24.             {
  25.             }
  26.         }
  27.  
  28.  
You can look into windows service( converting your windows application functionality into a windows service) as long as there is no GUI interaction needed....
Mar 10 '09 #2
kunal pawar
297 Contributor
Or you can write Windows service which give the call to your application.
Mar 10 '09 #3
PRR
750 Recognized Expert Contributor
@kunal pawar
If you call a program from windows service, the "program" runs in the context service account (system,local or network)... This may have its own implications... Obviously the "program" wont be visible to the current active user... however it will be visible on task manager or if you loop through like
Expand|Select|Wrap|Line Numbers
  1. System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcesses(); 
  2.  
you will find it ....
So the "program" wont be visible in GUI.... Try opening a notepad from service or taking a system snap... you will get the picture ....
Mar 10 '09 #4
cmrhema
375 Contributor
Thank you Deep Blue for your valuable suggestions.
We tried a "lazy" method. Created a shortcut and placed in the Windows Startup menu folder.

Once again thanks
Mar 11 '09 #5
PRR
750 Recognized Expert Contributor
Welcome cmrhema! Do continue to post your queries on Bytes
Mar 11 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Phil Stanton | last post by:
When designing a new form or report, the Default ForeColor is often something like -2147483640 which is the colour of Windows text (possibly black) and the default backColor is -2147483643...
7
by: Simon Harvey | last post by:
Hi everyone, I need to make a service that monitors a directory for changes in the files contained within it. I have two questions: 1. I'm going to be using a FileSystemWatcher object to do...
4
by: Blaxer | last post by:
I have read approximately 30 articles now on various methods to make your vb.net application automatically update itself and I can't see how they apply to a vb.net windows services projects. The...
4
by: DBC User | last post by:
Hi All, I asked this question in clickonce forum and no one seems to answer so I thought I will ask a border experts. I have an application, which uses 2 different set of files based on the...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
0
balabaster
by: balabaster | last post by:
Hi, I know this question has been answered before (somewhat) but I have a twist... I've written a client/server application where the server portion runs as a windows service and allows...
0
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: Programs dealing with autoruns Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list programs that help me to view/modify the autoruns...
2
by: iheartvba | last post by:
Hi, I have an application which I would like to firstly open Automatically, and secondly after the application has opened it should execute certain commands within the opened application...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.