0

I need to develop a project using Visual Studio. The project will run constantly in the background, checking a file path. When the image is uploaded to the file path, the application will display the uploaded image as a pop-up on the computer screen. The application will not be triggered by a user. It will constantly run in the Background, checking the file path. Which project template should I use for this? I hope I was able to explain.

I thought of writing windows service. Because it can run in the background. But I couldn't open a picture with it

ayse
  • 13
  • 3

1 Answers1

0

I see you're a new contributor, so it would be better if you posted a bit more context of what you have already tried. For instance, providing a minimal reproducible example. I ask you this because the way to write Windows Services or Console Applications in .Net Framework and .Net Core (and subsequent) are different. How to ask a question?

That being said, a windows service, by concept, does not have UI and is not allowed to have one. They're designed precisely to only run on the background, without user interaction (at least since Windows Vista).

These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface. From Microsoft Docs

So it seems that you need to either write your application as a different kind (for example), or create a secondary application that somehow communicates with your windows service. The decision would be up to you based on your requirements and/or possible limitations.

There are some possible alternatives in this possibly related question as well.

Matheus Lemos
  • 578
  • 4
  • 13
  • Thanks a lot for the reply. I think I need to write a secondary application. This app will display the picture on the screen. And I need to trigger this application with windows service. Am I right? – ayse Nov 28 '22 at 12:13
  • Yes, it's an idea. Please be aware that if the service itself starts the secondary application, it will not show as well. They have to be started separately and communicate between each other. You would need to test it to see if it's applicable to your situation. I would also recommend checking which Service Account is suitable for your needs as well, when installing the service. – Matheus Lemos Nov 28 '22 at 12:27
  • Additional reading: https://stackoverflow.com/questions/3798612/service-starting-a-process-wont-show-gui-c-sharp https://stackoverflow.com/questions/5063731/is-there-any-way-to-start-a-gui-application-from-a-windows-service-on-windows-7 – Matheus Lemos Nov 28 '22 at 12:27