Automatic Arduino detection and execution WindowsFormApp

Hello,

i am writing a program that detects if a 24V pump is running or not or if there is an error (e.g. no pump connected). I will realize this with Ardunio Due. The whole thing will be realized with WindowsFormApp as a small state machine. I will build the Arduino and the other components into a small case. Now my question: How is it possible that the PC automatically detects when the Arduino Due is plugged into the USB and automatically opens and runs WindowsFormApp?

assuming the Due appears as a PC COM: port you can get a list of COM ports, e.g. in C#
you can then prompt the device attached to each COM port in turn - the Due will be programmed to recognise a specified prompt and return an acknowledgement - you then proceed to communicate using the COM port

I think the OP is interested in a situation like what happens when I insert a DVD into my USB-connected DVD player. My Linux PC can be set to run the VLC media player program automatically when the DVD is detected.

I presume you can do something similar with Windows.

...R

Yes exactly how @Robin2 describes it

guti97:
Yes exactly how @Robin2 describes it

never managed to that with COM ports
I start the application and have a loop checking COM ports every few seconds
when a new COM port is added prompt it to see if it is the one required