Initialize function

Calls MddBootstrapInitialize to initialize the calling process to use the specified version of the Windows App SDK's framework package. If the call fails, throws an exception.

Syntax

inline auto Initialize(
    uint32_t majorMinorVersion = WINDOWSAPPSDK_RELEASE_MAJORMINOR,
    PCWSTR versionTag = WINDOWSAPPSDK_RELEASE_VERSION_TAG_W,
    PackageVersion minVersion = WINDOWSAPPSDK_RUNTIME_VERSION_UINT64)

Parameters

majorMinorVersion See majorMinorVersion in MddBootstrapInitialize. Defaults to WINDOWSAPPSDK_RELEASE_MAJORMINOR.

versionTag See versionTag in MddBootstrapInitialize. Defaults to WINDOWSAPPSDK_RELEASE_VERSION_TAG_W.

minVersion See minVersion in MddBootstrapInitialize. Defaults to WINDOWSAPPSDK_RUNTIME_VERSION_UINT64.

Return value

On success, returns a resource acquisition is initialization (RAII) object which, when it goes out of scope, undoes the changes that were made by the call to MddBootstrapInitialize.

Example

#include <windows.h>

#include <winrt\base.h>

#include <WindowsAppSDK-VersionInfo.h>
#include <MddBootstrap.h>

#include <iostream>

namespace MddBootstrap {using namespace
    ::Microsoft::Windows::ApplicationModel::DynamicDependency::Bootstrap; }

int main()
{
    try
    {
        auto mddBootstrapCleanup{ MddBootstrap::Initialize() };
        // Do work here.
    }
    catch (const winrt::hresult_error& ex)
    {
        const auto hr{ ex.code() };
        std::cout << "Error 0x" << std::hex << hr << " in Bootstraper initialization";
        return hr;
    }
    return 0;
}

Requirements

Minimum supported SDK: Windows App SDK version 1.1

Namespace: Microsoft::Windows::ApplicationModel::DynamicDependency::Bootstrap

Header: MddBootstrap.h

See also