How can I turn on my computer and immediately execute my program using C#? [closed]
well i am developing a simple program (for me) it is for a note notes, you put a day and a time to your note, when it was the time and day, it appears a ballontip,
i have a problem here to, any time i put to this ballontip, it ever get to be only 5 secondsDateTime hora; // hora == time
DataTable tabla = daonota.seleccionaraahora(); //chose now =seleccionar ahora
if (tabla.Rows.Count == 1)
{
hora = Convert.ToDateTime( tabla.Rows[0][4].ToString());
string titulo = tabla.Rows[0][1].ToString();
String texto = tabla.Rows[0][2].ToString();
texto=texto+"\Date programmed="+tabla.Rows[0][3].ToString();
texto = texto + "\nTime programmed=" + tabla.Rows[0][4].ToString();
notifyIcon1.ShowBalloonTip(10000, titulo, texto, ToolTipIcon.Info);
}
i have this code in a timer (timer1) it do a query every secund, do you know any form better for to do it (goal is it appears a ballon tip in the time put)
well i want to to ... if the computer is turn off, it turn on, any code for to do it since c#? and another thing... how do i do, my program is execute since the compu开发者_运维技巧ter turn on, automatically?
I don't think I understood the whole question but still a few points:
You may want to look at the Windows Service type application. It will start before a User logs in.
"I [..] do a query every secund" : That's too fast for the balloon stuff. The noftification has it's own Timing and Queuing rules.
Well it's limited
Minimum and maximum timeout values are enforced by the operating system and are typically 10 and 30 seconds, respectively, however this can vary depending on the operating system. Timeout values that are too large or too small are adjusted to the appropriate minimum or maximum value. In addition, if the user does not appear to be using the computer (no keyboard or mouse events are occurring) then the system does not count this time towards the timeout.
Other limitations, background info: http://www.csharp411.com/notifyiconshowballoontip-issues/
- Timeout Limits
- Requires User Activity
- One Balloon at a Time
- Balloon Never Closes
Tip: To Close Balloons
To explicitly close a balloon at any time, simply set the NotifyIcon.Visible property to false, then immediately back to true.
You need to put a link to your program in the registry at:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
Then it will run every time the computer starts.
Add your program to your startup folder.
Your program need to be a Process. Search for "C# Process"
精彩评论