contextfree / winrt-rust

Use and (eventually) make Windows Runtime APIs with Rust
Apache License 2.0
142 stars 10 forks source link

Toast Notification Example Doesn't Work on Windows 10 #44

Closed Eilie closed 6 years ago

Eilie commented 6 years ago

Hello,

After cloning the repo and executing

cargo run --example toast_notify --features "windows-data windows-ui"

Nothing really happens, no error, no toast, nothing. Program exits with code 0. Not sure how to debug it. I could give more info but not sure what matters as well. My rustc version is 1.23-nightly. https://github.com/allenbenz/winrt-notification Doesn't work as well in same way.

Boddlnagg commented 6 years ago

I can reproduce this problem here ... the culprit seems to be the Fall Creators Update. See this stackoverflow answer.

Replacing the AppId "myrustapp.exe" with "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\WindowsPowerShell\\v1.0\\powershell.exe" in the example code in toast_notify.rs "fixes" this issue for me (in the sense that the notification appears again, but it is displayed as belonging to PowerShell).

I don't know if I should commit that kind of workaround, but anything else (like registering your own AppId) is probably out of scope for such a simple example.

By the way, Microsoft's API documentation has always stated that you need your own AppId for this to work, and it was actually a "bug" before Fall Creators Update that it worked with a bogus AppId such as "myrustapp.exe".

Boddlnagg commented 6 years ago

It works on master now. I just used PowerShell's App ID, which is not very pretty, but this is just an example anyway ...