how to send a message to the windows notification center?

Just starting out? Need help? Post your questions and find answers here.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: how to send a message to the windows notification center?

Post by JHPJHP »

Hi ChrisR,

Thanks again for testing the examples.

Added the example I spoke about here, and included a simple Image2Base64 script.
In addition, I made a small change to the SetExecutionPolicy Procedure, adding -Scope CurrentUser; updated all examples.
Last edited by JHPJHP on Sun May 02, 2021 8:52 pm, edited 1 time in total.
User avatar
A.D.
User
User
Posts: 98
Joined: Tue Oct 06, 2009 9:11 pm

Re: how to send a message to the windows notification center?

Post by A.D. »

JHPJHP, Thanks for your example. Is it possible to show the toast just in the center?
Repeat
PureBasic
ForEver
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: how to send a message to the windows notification center?

Post by JHPJHP »

Hi A.D.

Yes; updated Windows Services & Other Stuff\Other_Stuff\PowerShell\ToastNotification\ToastNotification_2.pb

Replace:

Code: Select all

[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("PureBasic").Show($xmlToast)
With:

Code: Select all

$toast = [Windows.UI.Notifications.ToastNotification]::new($xmlToast)
$toast.Tag = "PureBasic"
$toast.Group = "PureBasic"
$toast.ExpirationTime = [DateTimeOffset]::Now.AddMinutes(5)
$toast.SuppressPopup = $true

[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("PureBasic").Show($toast)
User avatar
A.D.
User
User
Posts: 98
Joined: Tue Oct 06, 2009 9:11 pm

Re: how to send a message to the windows notification center?

Post by A.D. »

very nice :D, didn't know what Powershell can do. I was thinking of writing a DLL in C# for PureBasic instead of using the powershell but the truth is, i'm not able to write in C# (yeah, i'm getting old!). Thanks!
Repeat
PureBasic
ForEver
novablue
Enthusiast
Enthusiast
Posts: 165
Joined: Sun Nov 27, 2016 6:38 am

Re: how to send a message to the windows notification center?

Post by novablue »

Is there no winapi command to trigger a windows notification? I don't want to enable scripting or use powershell. There has to be a better way of doing this?
Post Reply