MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
230 stars 494 forks source link

What does "This method cannot be used by desktop callers." mean in context? #1249

Open gwynjudd opened 5 years ago

gwynjudd commented 5 years ago

Having followed the guide here https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop to get notifications working, I then worked through to this page and found the note:

Important

This method cannot be used by desktop callers.

Can some elaboration be made on this? For context, I have used the document I linked to above to get notifications working (at least as proof of concept), in a desktop application (classic Win32). Having done so, I modified my code to try out creating a scheduled notification:

        // And create the toast notification
        var toast = new ScheduledToastNotification(doc, DateTimeOffset.Now.AddSeconds(10));

        // And then show it
        DesktopNotificationManagerCompat.CreateToastNotifier().AddToSchedule(toast);

To my surprise, it seems to work without issue, at least in this simple case? Is it an accident? Can it be expected to work in general?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

RandomEngy commented 8 months ago

Scheduling notifications no longer seems to work in a regular win32 app. Tested on Windows 11 22H2, 22621.3007.