IApplicationDesignModeSettings2 interface (shobjidl_core.h)

Enables development tool applications to dynamically control system and user states, such as native display resolution, device scale factor, and application view layout, reported to Windows Store apps for the purpose of testing Windows Store apps running in design mode for a wide range of form factors without the need for the actual hardware. Also enables testing of changes in normally user-controlled state to test Windows Store apps under a variety of scenarios.

Inheritance

The IApplicationDesignModeSettings2 interface inherits from IApplicationDesignModeSettings. IApplicationDesignModeSettings2 also has these types of members:

Methods

The IApplicationDesignModeSettings2 interface has these methods.

 
IApplicationDesignModeSettings2::GetApplicationSizeBounds

This methods retrieves the size bounds supported by the application.
IApplicationDesignModeSettings2::GetApplicationViewOrientation

Gets the orientation of the application design mode window.
IApplicationDesignModeSettings2::SetAdjacentDisplayEdges

Sets whether the application window will be adjacent to the edge of the emulated display.
IApplicationDesignModeSettings2::SetApplicationViewMinWidth

Sets the desired minimum width of the application design mode window.
IApplicationDesignModeSettings2::SetApplicationViewOrientation

Sets the window orientation used for the design mode window.
IApplicationDesignModeSettings2::SetIsOnLockScreen

This method determines whether or not the application, in design mode, can display information on the Windows 8 lock screen.
IApplicationDesignModeSettings2::SetNativeDisplayOrientation

Sets the orientation of the emulated display for the design mode window.

Remarks

This interface is acquired by cocreating CLSID_ApplicationDesignModeSettings. It is an extension of the original IApplicationDesignModeSettings interface.

Examples

In this example, Visual Studio is launching an application in design mode that has overridden the minimum width on a display of size 1366x768. It is then enabling a slider control that allows the user to dynamically change the applications width. To do this, it needs to use the new SetApplicationViewMinWidth and GetApplicationSizeBounds APIs to compute the minimum and maximum sizes allowed for this type of application.

For more info about IInitializeWithWindow::Initialize, see Display WinRT UI objects that depend on CoreWindow.

ComPtr<IApplicationDesignModeSettings> spDesignModeSettings;

// CoCreate the design mode settings object
HRESULT hr = CoCreateInstance(CLSID_ApplicationDesignModeSettings, nullptr, CLSCTX_INPROC, IID_PPV_ARGS(&spDesignModeSettings));
if (SUCCEEDED(hr))
{
    ComPtr<IInitializeWithWindow> spInitializeWithWindow;
    hr = pDesignModeSettings->QueryInterface(IID_PPV_ARGS(&spInitializeWithWindow);
    if (SUCCEEDED(hr))
    {
        // Before we set any design mode state, we must first initialize the
        // design mode settings object with a proxy core window. Since apps
        // running in design mode don't have an actual core window, we must
        // supply an HWND that can be used as a proxy.
        hr = spInitializeWithWindow->Initialize(hwndProxyCoreWindow);
    }

    if (SUCCEEDED(hr))
    {
        // Set the native display size to 1366x768
        SIZE sizeDisplay = {1366, 768};
        hr = spDesignModeSettings->SetNativeDisplaySize(sizeDisplay);
        if (SUCCEEDED(hr))
        {
            // Set the native display orientation to landscape
            hr = spDesignModeSettings->SetNativeDisplayOrientation(NDO_LANDSCAPE);
            if (SUCCEEDED(hr))
            {
                // Set the scale factor to 100%
                DEVICE_SCALE_FACTOR scaleFactor = SCALE_100_PERCENT;
                hr = spDesignModeSettings->SetScaleFactor(scaleFactor);
            }
        }
    }

    if (SUCCEEDED(hr))
    {

        // Override the app’s minimum width
        hr = spDesignModeSettings->SetApplicationViewMinWidth(AVMW_320);
        if (SUCCEEDED(hr))
        {
            SIZE sizeAppMin;
            SIZE sizeAppMax;
            hr = spDesignModeSettings->GetApplicationSizeBounds(&sizeAppMin, &sizeAppMax);
            if (SUCCEEDED(hr))
            {
                // Push the min and max size to the slider control,
                // to update the values that it maps to
                …

                // Start by sizing the app to its min bound, so compute the                         
                // resulting view orientation
                APPLICATION_VIEW_ORIENTATION viewOrientation;
                hr = spDesignModeSettings->GetApplicationViewOrientation(sizeAppMin, &viewOrientation);
                if (SUCCEEDED(hr))
                {
                    // Set the app view orientation
                    hr = spDesignModeSettings->SetApplicationViewOrientation(viewOrientation);
                }
            }
        }
    }

    if (SUCCEEDED(hr))
    {
        // Set the adjacent display edges so that the app is touching just the left edge of the screen
        hr = spDesignModeSettings->SetAdjacentDisplayEdges(ADE_LEFT);
    }
}

Requirements

Requirement Value
Minimum supported client Windows 8.1 [desktop apps only]
Minimum supported server Windows Server 2012 R2 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)

See also

IApplicationDesignModeSettings