Search code examples
c#.netwindowsstartup

.NET Make C# Program run in background and at startup like Anti Virus


For a big project I am going to be making a C# Program which does a variety of things that a user specified, there is a user interface, that will be accessible from a System Icon, and ever present logo on the screen.

I want the program to run at start up and be there in the background until shutdown, such as many common antivirus/malware programs out there today.

I also want the program to be installed in order to run.

I know there's alot here. I know how to get the program to run at startup (startup folder), but like with AntiVirus I want it to always be there, and not just be in the startup folder...

I originally thought this was a service, but I am not too sure now, and I am having a nightmare getting my head around it all. What is the best way to do this ? The GUI is a must.

Would appreciate any and all answers, tips and suggestions.

Thanks in advance.


Solution

  • Anti-virus programs and similar system tray applications sometimes or often have 2 components. There's a service that starts with the system, and a separate system tray application in the startup folder that interacts with the server to provider user access to service functionality when a user is logged in to a desktop. One of the questions you'll have to answer is whether you want anything running when nobody is logged in. If so, you'll want a service component. If not, you can maybe put everything in one application that creates a system tray icon. To put an icon in the system tray from a .NET application, refer to http://www.developer.com/net/net/article.php/3336751/C-Tip-Placing-Your-C-Application-in-the-System-Tray.htm

    If I understand/recall correctly, there's a .NET component designed for putting icons in the system tray.