Hello @Afon.zhang ,
In fact, my fundamental problem is how to detect the disconnection and how to turn on the disconnected display if one of the monitors is disconnected under the multi monitor
"Disconnect this display" option is available when there are three monitors connected to the system.
When you click "Disconnect this display" option via settings, WM_DISPLAYCHANGE message will send to your window application. You can use this message as a trigger to connect / enable the display later. Actually, there is no connect / enable option, there is duplicate or extend option.
For disconnected display, if you want to duplicate you can refer to this thread for more detailed information: "Display Duplicate optionally with three monitors connected in the OS". if you want to extend, you can try the following code:
void ExtendDisplay()
{
LONG hr;
hr = SetDisplayConfig(0, NULL, 0, NULL, SDC_TOPOLOGY_EXTEND | SDC_APPLY);
if (hr == ERROR_SUCCESS) {
printf("Extend succeed !");
}
}
Thank you!
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.