C# app to record currently focused window
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Program.cs 955B

12345678910111213141516171819202122232425262728293031323334
  1. namespace WindowMonitor
  2. {
  3. using System;
  4. using System.ServiceProcess;
  5. /// <summary>
  6. /// The main entry point. Starts the service either as a console app or
  7. /// registered with the service manager.
  8. /// </summary>
  9. internal static class Program
  10. {
  11. /// <summary>
  12. /// The main entry point for the application.
  13. /// </summary>
  14. public static void Main()
  15. {
  16. if (Environment.UserInteractive)
  17. {
  18. var service = new WindowMonitorService();
  19. service.Startup();
  20. Console.WriteLine("Service started; Press <enter> to stop.");
  21. Console.ReadLine();
  22. service.Shutdown();
  23. }
  24. else
  25. {
  26. ServiceBase.Run(new ServiceBase[]
  27. {
  28. new WindowMonitorService()
  29. });
  30. }
  31. }
  32. }
  33. }