how to send a message to the windows notification center?

Just starting out? Need help? Post your questions and find answers here.
User avatar
A.D.
User
User
Posts: 98
Joined: Tue Oct 06, 2009 9:11 pm

how to send a message to the windows notification center?

Post by A.D. »

does anybody have a code to send a message to Window's notification center?

Regards
A.D.
Repeat
PureBasic
ForEver
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. »

does nobody know how to do this?
Repeat
PureBasic
ForEver
GenRabbit
Enthusiast
Enthusiast
Posts: 118
Joined: Wed Dec 31, 2014 5:41 pm

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

Post by GenRabbit »

Dunno if I totally understand what you mean?
But if its to send a message to a window, you could use sendmessage_() or _sendMessage() I believe. This is a windows system call
more info here;
https://docs.microsoft.com/en-us/window ... endmessage
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

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

Post by Marc56us »

I think yo ask for the notifications panel on Windows 10 ? (Win +A)
Notifications on W10 taskbar (Balloon Tooltips or 'Toast notifications') can be added to notification panel after being closed.
(but I don't know how to)
:wink:
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. »

yes, i mean the window 10 notification center on the right panel. Would be cool to have code for it!
Repeat
PureBasic
ForEver
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

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

Post by RASHAD »

Hi
Search the forum for System Tray Balloon by Michael Vogel (MV)
Egypt my love
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. »

i'm looking for something like this https://github.com/deseven/pb-macos-notifications just for Windows 10! I think such toast notifications need to be declared as a Window 10 App to have access to the notification 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.

Sent you a PM; original code can be found @ Windows Services & Other Stuff\Other_Stuff\PowerShell\ToastNotification\...

NOTE: Currently the code is to big to post as it uses base64 images.

Image
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

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

Post by BarryG »

[Deleted; I don't know shit]
Last edited by BarryG on Sun May 02, 2021 7:03 am, edited 1 time in total.
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 »

For basic notifications RASHAD is correct (System Tray Balloon).
But I thought the image I posted made it clear that Toast Notifications are different, and offer another level of messaging.

See the following XML and Toast Notification below:

NB*: I copied and pasted the XML into my existing example and the results were identical.

Code: Select all

<toast scenario="reminder">
  <visual>
    <binding template="ToastGeneric">
      <text>Windows 10 Semiannual Update 1809</text>
      <text>Required by 5:00 PM, Fri, 1/25/19</text>
      <text>You can visit Software Center at any time to view more details or install updates before the required deadline.</text>
      <image placement="hero" src="https://picsum.photos/364/180?image=1043"/>
    </binding>
  </visual>
  <actions>
    <input id="snoozeTime" type="selection" title="Click Snooze to be reminded in:" defaultInput="15">
      <selection id="15" content="15 minutes"/>
      <selection id="60" content="1 hour"/>
      <selection id="240" content="4 hours"/>
      <selection id="480" content="8 hours"/>
    </input>
    <action activationType="system" arguments="snooze" hint-inputId="snoozeTime" content=""/>
    <action activationType="system" arguments="dismiss" content=""/>
  </actions>
</toast>
Image
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

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

Post by BarryG »

JHPJHP wrote: Sun May 02, 2021 2:36 amI thought the image I posted made it clear that Toast Notifications are different, and offer another level of messaging.
Oh, sorry, I didn't realise that image was an example toast notification. But yeah, you're right. Some notifications are more than just messages/balloon tips.
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

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

Post by Marc56us »

It would be nice if someone could give a small, complete and functional example ("Hello World")

For information, with other tools like AutoIt, a simple

Code: Select all

TrayTip("Information", "Hello World!.", 30, 17)
... is enough to display a toast on Windows 10 ("title", "message", timeout, icon)
(but does not keep it in the notification center)

This is one of the easiest ways to get the user's attention in a program.
The advantage is also that you can't validate it by mistake by pressing enter like a modal box (MessageRequester)

Feature request for 5.74 :idea: :?:

:wink:
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

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

Post by ChrisR »

@JHPJHP
It didn't work the first time for me, Script execution is disabled here
But it worked fine after adding Set-executionpolicy unrestricted
It goes through Powershell but nice toast

Code: Select all

ProgramResult = RunProgram("powershell", "Set-executionpolicy unrestricted;" + #DQUOTE$ +   TemporaryDirectory + "_ToastNotification.ps1" + #DQUOTE$, #Null$, #PB_Program_Hide | #PB_Program_Open | #PB_Program_Read)
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,

Thank you for reporting the problem.

There already are Procedures to handle the Execution Policy (see RestorePoint.pbi), but I didn't think they were needed here.
The examples have been updated to set and restore the original Execution Policy; I believe RemoteSigned should be enough.
Last edited by JHPJHP on Sun May 02, 2021 4:02 pm, edited 1 time in total.
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

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

Post by ChrisR »

Hi JHPJHP,
It's all good with script execution disabled by default here :)
Post Reply