Understanding wxNotificationMessage::MSWUseToasts Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
sw
Knows some wx things
Knows some wx things
Posts: 34
Joined: Sat Mar 16, 2019 8:09 pm

Understanding wxNotificationMessage::MSWUseToasts

Post by sw » Tue Feb 18, 2020 3:18 pm

I'm trying to understand

Code: Select all

wxNotificationMessage::MSWUseToasts(const wxString& shortcutPath = wxString(), const wxString& appId = wxString()) 	
Specifically understanding it's parameters as defined in the docshttps://docs.wxwidgets.org/trunk/classw ... 19f4795242

In my application you can have it sit in the TaskBar or not. If that option is not enabled, it should suppress the notification icon in the TaskBar area.

If the application is installed through a third party installer (Inno Setup), you have the option of not creating a shortcut at all. In the docs it says the first parameter is required (the shortcut path). I have defined a AppId as well, but the second parameter isn't as important as the first.

So my question is
  • Should I always just create shortcut path when installing my application and then use the Windows Shell COM interface to retrieve my application shortcut path
  • Or am I not understanding that method correctly?
I did try leaving both parameters empty (i.e. their defaults) but this results in a crash. This was with no shortcut path for the application being defined at all.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4175
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Understanding wxNotificationMessage::MSWUseToasts

Post by ONEEYEMAN » Tue Feb 18, 2020 3:54 pm

Hi,
Where the program crashed?
Can you show the backtrace?

Also, why do you need that functionality?

Thank you.

sw
Knows some wx things
Knows some wx things
Posts: 34
Joined: Sat Mar 16, 2019 8:09 pm

Re: Understanding wxNotificationMessage::MSWUseToasts

Post by sw » Tue Feb 18, 2020 6:11 pm

I think I know what I was doing wrong.

Previously, I was calling the method like so:

Code: Select all

wxNotificationMessage::MSWUseToasts(wxGetEmptyString(), wxGetEmptyString());
Now, calling it like so works:

Code: Select all

wxNotificationMessage::MSWUseToasts();
So I assume that now wxWidgets is filling in the two parameters? But it works now and as expected... As odd as it sounds.

When I was trying out wxNotificationMessage, I would notice that if there was no wxTaskBarIcon, when a notification message would be display, it would display with the wxWidgets icon the tray area, so I wanted suppress the icon when the TaskBarIcon is turned off.

This is how the logic is structured:

Code: Select all

if (pConfig->IsShowInTray()) {
	wxNotificationMessage::UseTaskBarIcon(pTaskBarIcon);
} else {
	 wxNotificationMessage::MSWUseToasts();
}

Post Reply