|
How can i run a program in the background? I've putted 0% oppacity but when i press alt+tab it shows that there is something running.
Thanks, Guilhreme
|
| guilhermecvm1 Wednesday, June 21, 2006 4:23 PM |
| guilhermecvm wrote: | this one: http://msdn2.microsoft.com/en-us/library/system.windows.forms.notifyicon.aspx ?? This, the icon appear but when i Close the app the program closes, and don't still runing.
Well, the program will e-mail me everytime the IP is changed, and i want to run it in the background, i don't want it to be show in the either taskbar and traybar. |
|
You need to override the close behavior by adding a FormClosing event handler that does the following: | | private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; this.Visible = false; } }
|
|
| Peter Ritchie Wednesday, June 21, 2006 9:09 PM |
Run in the background in what way? Have no UI at all? Just not show up in the alt+tab display?
You may want to look into running it as a Windows Service or perhaps adding a NotifyIcon(so as to givethe user some way to get to your running app)and hiding any forms that are visible (even when at 0% oppacity) with their Hide() method. |
| Brendan Grant Wednesday, June 21, 2006 4:28 PM |
Well, when u put the MSN in the tray, it doesn't appear when you press alt+tab.. emule too, that's what i'm talking about u see?
|
| guilhermecvm1 Wednesday, June 21, 2006 8:00 PM |
If you want to have an icon in the system tray you'll want to add a NotifyIcon component to your form. |
| Peter Ritchie Wednesday, June 21, 2006 8:06 PM |
Yeah, but how to make the app disapear, but continue running?
|
| guilhermecvm1 Wednesday, June 21, 2006 8:19 PM |
| guilhermecvm wrote: | Yeah, but how to make the app disapear, but continue running?
|
|
The documentation at the link I provided has an example of how to do just that. |
| Peter Ritchie Wednesday, June 21, 2006 8:24 PM |
this one: http://msdn2.microsoft.com/en-us/library/system.windows.forms.notifyicon.aspx ?? This, the icon appear but when i Close the app the program closes, and don't still runing.
Well, the program will e-mail me everytime the IP is changed, and i want to run it in the background, i don't want it to be show either in the taskbar and traybar. |
| guilhermecvm1 Wednesday, June 21, 2006 8:44 PM |
So lose the NotifyIcon and fire off the Hide() method on your form after it has finished loading... otherwise run it as a Windows Serviceand be completely out of sight and out of mind. |
| Brendan Grant Wednesday, June 21, 2006 8:53 PM |
| guilhermecvm wrote: | this one: http://msdn2.microsoft.com/en-us/library/system.windows.forms.notifyicon.aspx ?? This, the icon appear but when i Close the app the program closes, and don't still runing.
Well, the program will e-mail me everytime the IP is changed, and i want to run it in the background, i don't want it to be show in the either taskbar and traybar. |
|
You need to override the close behavior by adding a FormClosing event handler that does the following: | | private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; this.Visible = false; } }
|
|
| Peter Ritchie Wednesday, June 21, 2006 9:09 PM |
I still don't understand.
Do you know when you click in the "X" from Msn Messenger Window? The Windows Closes, but the app still run. That's what i want, but when you click the app it starts with the window closed !
|
| guilhermecvm1 Wednesday, June 21, 2006 9:12 PM |
Yeahh.. this works sorry for not being objectivly at others post.
Thanks, Guilherme
|
| guilhermecvm1 Wednesday, June 21, 2006 9:18 PM |