visual-studiowinapitoastembedded-resource

Referencing compiled resources in .exe for with URI for toast notifications?


With a normal Win32 C++ application with compiled resource file (.rc), how does one reference the icons, bitmaps and png files from the resource using a URI required for toast notifications?

I presume it must have something to do with the ms-resource scheme but couldn't find any real information on this?

TIA


Solution

  • Unfortunately, "toast notifications" (now formal known as "app notifications") simply do not support using images from an executable's resources. As documented on MSDN:

    App notification content

    The images you use in your toast notification can be sourced from...

    • http://
    • ms-appx:///
    • ms-appdata:///

    As you can see, toasts do not allow ms-resource.

    The ms-appx and ms-appdata URI schemes are documented on MSDN:

    URI schemes

    Use the ms-appx or the ms-appx-web URI scheme to refer to a file that comes from your app's package (see Packaging apps). Files in your app package are typically static images, data, code, and layout files. The ms-appx-web scheme accesses the same files as ms-appx, but in the web compartment.

    Use the ms-appdata URI scheme to refer to files that come from the app's local, roaming, and temporary data folders. For more info about these app data folders, see Store and retrieve settings and other app data.

    That same page also documents the ms-resource URI scheme:

    Use the ms-resource URI scheme to refer to strings loaded from your app's Resources Files (.resw). For examples and more info about Resources Files, see Localize strings in your UI and app package manifest.