For my current C++ project I need to detect a unique string for every monitor that is connected and active on a large number of computers.
Research has pointed to 2
I've never tried doing it from a service, but EnumDisplayDevices generally works well when run as a user. I believe that services run in a separate (and headless) session, which could explain the problem you're seeing there.
Could you run a helper program from your service, impersonating a user account that has access to the displays?