简体   繁体   中英

changing screen orientation programmatically in mirror mode windows 7

How to change screen orientation of each screen individually from C++ or C#? Having dual screen display configuration in mirror mode. Intel Graphics card is installed on the machine. I tried EnumDisplaySettings function and DeviceMode structure. However, it only works in extended mode. If I try to change orientation by this function in mirror mode both screens are set to the same orientation. Maybe there is a way to change this settings through Intel driver SDK or any other native windows 7 functionality?

UPDATE 1:

Here is the code I tried with CCD API. It still rotates both displays =(

UINT32 PathArraySize = 0;
UINT32 ModeArraySize = 0;
DISPLAYCONFIG_PATH_INFO* PathArray;
DISPLAYCONFIG_MODE_INFO* ModeArray;
DISPLAYCONFIG_TOPOLOGY_ID CurrentTopology;  

SetDisplayConfig(0,NULL,0,NULL,SDC_TOPOLOGY_CLONE|SDC_APPLY); //set to clone mode
GetDisplayConfigBufferSizes(QDC_ALL_PATHS, &PathArraySize, &ModeArraySize);

PathArray =   (DISPLAYCONFIG_PATH_INFO*)malloc(PathArraySize * sizeof(DISPLAYCONFIG_PATH_INFO));
memset(PathArray, 0, PathArraySize * sizeof(DISPLAYCONFIG_PATH_INFO));
ModeArray =   (DISPLAYCONFIG_MODE_INFO*)malloc(ModeArraySize * sizeof(DISPLAYCONFIG_MODE_INFO));
memset(ModeArray, 0, ModeArraySize * sizeof(DISPLAYCONFIG_MODE_INFO));
LONG ret = QueryDisplayConfig(QDC_DATABASE_CURRENT,&PathArraySize, PathArray, &ModeArraySize, ModeArray, &CurrentTopology);

PathArray++;
PathArray->targetInfo.rotation =  DISPLAYCONFIG_ROTATION_ROTATE180; //set Second display rotated 180
PathArray--;

SetDisplayConfig(PathArraySize,PathArray,ModeArraySize,ModeArray, SDC_APPLY | SDC_SAVE_TO_DATABASE | SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG); //apply rotation

free(PathArray);
free(ModeArray);

You can try using the CCD APIs . These functions allows you to manipulate the VidPN topology for your current session. They aren't the easiest functions to call though.


Edit:

I don't see anything wrong with your code, apart from maybe the SDC_ALLOW_CHANGES flag. I tried your code on my system which has a Nvidia card. It does one of two things depends on which target I rotate. If I rotate the 2nd of the two targets, it ignores the change. In the Nvidia control panel, I can see the 2nd monitor is rotated, but its settings are greyed out. This suggests to me that the Nvidia driver doesn't support what you want to do. If I rotate the first target, it causes both targets to rotate. I've also tried changing the target scaling to DISPLAYCONFIG_SCALING_STRETCHED . That also made no difference. SetDisplayConfig returns 0. Windows at least seems to be happy with the change.

Have you tried to do what you want with the Intel display utility? If you can't do it with the Intel tool, then maybe the Intel driver doesn't support it. You probably want to ask someone from Intel on whether it is supported.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM