We have a few Windows 10 Pro computers with Remote Desktop enabled. There are also "client" machines running Windows 10 Pro and Windows 10 Home.

Is it possible to programmatically check, from a client machine, that the remote computer is already occupied by someone? That is, if another remote client is already connected to it? If so, can I do this without breaking the existing remote connection?

C++ code would be preferable, but if you know a solution in another language, please share it.