I don't know if you are still interested in a solution.
You have to make use of CCD (Connecting and Configuring Displays) and you can only do that by calling windows functions with dllimport.
Here is the Link to CCD https://msdn.microsoft.com/en-us/library/windows/hardware/ff539367(v=vs.85).aspx
For this, you have to make 2 calls. First you have to get the buffer size and then the display config.
[DllImport("User32.dll")]
public static extern StatusCode GetDisplayConfigBufferSizes(
QueryDisplayConfigFlags flags,
out int numPathArrayElements,
out int numModeInfoArrayElements);
[Flags]
public enum QueryDisplayConfigFlags : uint
{
QDC_ZERO = 0x0,
QDC_ALL_PATHS = 0x00000001,
QDC_ONLY_ACTIVE_PATHS = 0x00000002,
QDC_DATABASE_CURRENT = 0x00000004
}
public enum StatusCode : uint
{
Success = 0,
InvalidParameter = 87,
NotSupported = 50,
AccessDenied = 5,
GenFailure = 31,
BadConfiguration = 1610,
InSufficientBuffer = 122,
}
int numPathArrayElements;
int numModeInfoArrayElements;
var status = CCDWrapper.GetDisplayConfigBufferSizes(
pathType,
out numPathArrayElements,
out numModeInfoArrayElements);
[DllImport("User32.dll")]
public static extern StatusCode QueryDisplayConfig(
QueryDisplayConfigFlags flags,
ref int numPathArrayElements,
[Out] DISPLAYCONFIG_PATH_INFO[] pathInfoArray,
ref int modeInfoArrayElements,
[Out] DisplayConfigModeInfo[] modeInfoArray,
out DISPLAYCONFIG_TOPOLOGY_ID_Flags topologyId
);
[Flags]
public enum DISPLAYCONFIG_TOPOLOGY_ID_Flags: uint
{
DISPLAYCONFIG_TOPOLOGY_ZERO = 0x0,
DISPLAYCONFIG_TOPOLOGY_INTERNAL = 0x00000001,
DISPLAYCONFIG_TOPOLOGY_CLONE = 0x00000002,
DISPLAYCONFIG_TOPOLOGY_EXTEND = 0x00000004,
DISPLAYCONFIG_TOPOLOGY_EXTERNAL = 0x00000008,
DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32 = 0xFFFFFFFF
}
DISPLAYCONFIG_PATH_INFO and DisplayConfigModeInfo are also needed in the call. They cannot be null. But these two structures include several other types which is too much to paste here.
If you follow the following link you find a sample project on github.
droid-autorotate@Github
From there you can copy the missing structures.