What are the windows multi monitor interrupt and enable commands

Afon.zhang 396 Reputation points
2020-12-14T01:09:42.767+00:00

47686-image.png

In Windows settings, the display with number 1 chooses to disconnect this display

I want to know what the windows command is to disconnect and start

I have inquired about some API enumdisplaymonitors, ChangeDisplaySettingsEx and other information, which can only be used when obtaining the display. I also inquired about some information about the power supply, but no available direction was found.

The problem I have now is that if you manually disconnect the second monitor in advance,

What I want to know is how to program or command to know that the second monitor is disconnected and how to turn on the disconnected display

When the number 1 is on, the display will not turn off when the number of the number screen is 1

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,412 questions
{count} votes

Accepted answer
  1. Rita Han - MSFT 2,161 Reputation points
    2020-12-16T06:12:25.517+00:00

    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.


0 additional answers

Sort by: Most helpful