windows.ui.notifications.h vs winrt/windows.ui.notifications.h | What should i use?

Paul 21 Reputation points
2021-05-24T19:25:07.607+00:00

I have a short question about Windows 10 development with cpp:

When should i use <windows.ui.notifications.h> and when <winrt/Windows.UI.Notifications.h>, and why are there two versions of this header.

I found out that windows.ui.notifications.h is in windowssdk.......\include\winrt and <winrt/Windows.UI.Notifications.h> is in windowssdk....\include\cppwinrt.
And windows.ui.notifications.h contains also namespaces like ABI::Windows::Data::Xml::Dom; whereas <winrt/Windows.UI.Notifications.h> does not contains these namespaces but the winrt namespace. So what should i use for what??? why are there the same headers but with such differences?
-- but i thought that for example, Windows::Data::Xml::Dom should be in Windows.Data.Xml.Dom.h and not accessible via the notifications header.

Can someone please help?

Universal Windows Platform (UWP)
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,422 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,527 questions
{count} votes

Accepted answer
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,851 Reputation points
    2021-05-25T07:07:29.117+00:00

    Hello, Welcome to Micorosoft Q&A,

    windows.ui.notifications.h vs winrt/windows.ui.notifications.h | What should i use?

    It is based on which namespace is selected for your uwp language. If you was using C++CX, please include windows.ui.notifications.h, And if you are using C++WinRT, please include winrt/windows.ui.notifications.h. Or it will throw head file not found exception.

    And windows.ui.notifications.h contains also namespaces like ABI::Windows::Data::Xml::Dom;

    A Windows Runtime class (runtime class) is really an abstraction. This abstraction defines a binary interface (the Application Binary Interface, or ABI) that allows various programming languages to interact with an object. Regardless of programming language, client code interaction with a Windows Runtime object happens at the lowest level, with client language constructs translated into calls into the object's ABI.

    For more please refer this document.


    If the response 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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful