Is there any Win32/COM/WinrRT API that returns the total number of Virtual desktops?
Microsoft has never documented any publicly available functions/interfaces for programmatically interrogating/managing virtual desktops. The design philosophy has always been that virtual desktops are a UI feature that should be controlled by the user, not applications. Some have experimented with undocumented interfaces but these have been a moving target through the years. Of course, that's not unusual for undocumented stuff.