I have made a small program in C# that I want to run in the background and it should only appear when a certain key combination is pressed. How can I do this?
A quick and dirty solution (I think the Window Service Application template is unavailable in Visual Studio Express and Standard):
Start a new Windows Forms Application. Add a new class to the solution and write the code you want inside it.
Go back to the form designer, set the WindowState property to Minimized, and add a Load event to the form. In the event handler hide the form and call your class:
private void Form1_Load(object sender, EventArgs e)
{
this.Hide();
MyNewClass mynewclass=new MyNewClass();
}
The application doesn't appear in the taskbar and you don't see it when you hit Alt+Tab. You can add a systray icon to it if you want, just like magol wrote:
NotifyIcon trayIcon = new NotifyIcon();
trayIcon.Icon=new Icon(@"C:\iconfilename.ico");
trayIcon.Visible = true;