Important: Please read the Qt Code of Conduct -

[WinRT] Display Microsoft ads in an app

  • I want to display banner and interstitial ads from Microsoft in my WinRt apps.

    First things first, I installed the Microsoft Store Services SDK. But then I ran into a little problem. According to the documentation:

    For a Universal Windows Platform (UWP) project: Expand Universal Windows, click Extensions, and then select the check box next to Microsoft Advertising SDK for XAML (Version 10.0).

    How can I do something equivalent in Qt Creator? How do I add an extension and how can I reference classes from the Advertising SDK? Has anyone tried this before? Is this undocumented or unsupported (yet)?

  • Adding in extensions is nothing short but setting additional include/lib paths for your project.

    You will need to do this manually, in a standard installation those are available in

    C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs

    For Advertising (I am pretty sure my setup is outdated), there is Microsoft.Advertising.Xaml which contains a couple of appx packages. Those files contain the libraries as well as the winmd files. In case your SDK does not provide headers, use a search engine to check for converting winmd to header files and use those then during development.

  • Indeed, there is a Microsoft.Advertising.XAML that contains appx packages, a Microsoft.Advertising.dll and a winmd file.

    I got the header (*.h) files using winmdidl and Midlrt . But when I tried to include the header files, I got tens of C2xxx and C3xxx errors coming from the header files.

    Here are the commands used to get the header files:

    "C:\Program Files (x86)\Windows Kits\10\bin\x64\winmdidl.exe" /outdir:c:\Temp\A "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.Advertising.Xaml\10.0\References\CommonConfiguration\neutral\Microsoft.Advertising.winmd"
    "C:\Program Files (x86)\Windows Kits\10\bin\x64\Midlrt.exe" "c:\Temp\A\Microsoft.Advertising.WinRT.UI.idl" /I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt" /I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared" /I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um" /I "C:\Temp\A" /metadata_dir "C:\Windows\System32\WinMetadata" /h "C:\Temp\B\Microsoft.Advertising.WinRT.UI.h"

    Where did I go wrong?

  • Qt Champions 2019

    @adrian.gabureanu You should say what error you get now. Especially the first error would be interesting.

  • @jsulm For example:

    Microsoft.Advertising.WINRT.UI.h looks like this:

  • Qt Champions 2019

    @adrian.gabureanu Which compiler do you use?

  • @jsulm MSVC2015 and I'm trying to build for Qt for WinRT 64bit

Log in to reply