I’ve seen this chapter from ofBook but it is not exactly what I need.
I need the OpenGL application to behave as a Windows service, windows services have two basic properties:
Launched when computer boots
Restarted if the program crashes
The first one is simple to accomplish, but for the second one I’m struggling. I could make another application that monitors my ofApp, and restarts it if it’s closed. But what if this secondary application also crashes?
You can use windows task scheduler to add app to startup:
You can create an app which will run on startup, and then run your primary app.
This app can monitor activity of your primary app, and in case if your app is not responding - kill all services with the same name as your primary app and then restart app or computer.
You can detect if primary app is healthy by sending pulse message to watch app every second, or using system commands you can check if the service with that name is still running.