Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can WinToast active toast after app exit? #102

Open
HXhlx opened this issue May 31, 2024 · 1 comment
Open

How can WinToast active toast after app exit? #102

HXhlx opened this issue May 31, 2024 · 1 comment

Comments

@HXhlx
Copy link

HXhlx commented May 31, 2024

I tested message push using Firefox browser. When I closed Firefox browser and clicked on the message in the message center, it opened Firefox browser and redirected to the specified page. I'm not sure if WinToast can implement it. I have tried deleting clear() from ToastNotify::~ToastNotify(), but this only keeps the message in the message center and clicking on it has no effect.

This is my test demo:

#include "wintoastlib.h"

using namespace std;
using namespace WinToastLib;

class ToastNotify : public IWinToastHandler
{
public:
    void toastActivated() const override { system(R"("C:\Program Files\Google\Chrome\Application\chrome.exe" --flag-switches-begin --flag-switches-end)"); }
    void toastActivated(int actionIndex) const override { system(R"("C:\Program Files\Google\Chrome\Application\chrome.exe" --flag-switches-begin --flag-switches-end)"); }
    void toastDismissed(WinToastDismissalReason state) const override {}
    void toastFailed() const override {}
};

int main()
{
    WinToast::WinToastError error;
    WinToast::instance()->setAppName(L"Test");
    WinToast::instance()->setAppUserModelId(WinToast::configureAUMI(L"Com", L"Pro", L"Sub", L"Ver"));
    if (!WinToast::instance()->initialize(&error))
        cout << "Failed to initialize WinToast: " << error << endl;
    WinToastTemplate tmp(WinToastTemplate::ImageAndText02);
    tmp.setFirstLine(L"Title");
    tmp.setSecondLine(L"Content");
    tmp.setExpiration(false);
    INT64 toastId = WinToast::instance()->showToast(tmp, new ToastNotify);
    if (toastId == -1)
        cout << "Couldn't launch the toast notification!" << endl;
}
@HXhlx HXhlx changed the title How does WinToast active toast after app exit? How can WinToast active toast after app exit? May 31, 2024
@mohabouje
Copy link
Owner

This feature is missing. I will need to dig into the Microsoft docs and add it to the list of missing features for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants