Matthew van Eerde's web log

  • Matthew van Eerde's web log

    Programmatically rearranging displays

    • 0 Comments

    Most of my test machines and my laptop have a single display; but I have two dev machines which are each connected to two displays.

    When I clean install Windows, I sometimes need to rearrange the displays:

    Since I clean install Windows frequently, I wrote myself a little C++ app which does this programmatically using EnumDisplayDevices / EnumDisplaySettings / ChangeDisplaySettingsEx.

    Source and binaries attached.

    Pseudocode:

    for (each device returned by EnumDisplayDevices) {

       grab the position and the height/width using EnumDisplaySettings

    }

    calculate the desired position of the secondary monitor

    Set it using ChangeDisplaySettingsEx with DM_POSITION

     

    Call as:

    >swapmonitors
    Moved secondary monitor to (1920, 0)

    EDIT: Oops: 0 should be CDS_GLOBAL | CDS_UPDATEREGISTRY, to make the settings apply to all users, and to persist across display resets / reboots

    LONG status = ChangeDisplaySettingsEx(
        nameSecondary,
        &mode,
        nullptr, // reserved
        CDS_GLOBAL | CDS_UPDATEREGISTRY, // was 0
        nullptr // no video parameter
    );

  • Matthew van Eerde's web log

    Windows Sound test team rowing morale event

    • 0 Comments

    Last Friday the Windows Sound test team went kayaking.  We went to the Agua Verde paddle club and kayaked around Union Bay for a while.

    Here's the route we took:

     

    More detail:

    http://connect.garmin.com/activity/179545084

     

Page 1 of 1 (2 items)

May, 2012