Service Generated Notifications?

I have a Xojo service application and I was wondering if anyone has ever created notifications that display from the system tray in windows that can be generated using a service application? Is there a way to do this? I would appreciate any advice on how to do this or if it can or can’t be done using a system service. Thanks!

I’ve not done this in over cough years.

WMI seems to be the preferred method these days.

If you have MBS, check

“SELECT UserName FROM Win32_ComputerSystem”

Or via a free WMI method here

Sorry, I didn’t elaborate. It’ll need a separate program. That info above will let you know if a user is actually logged on, you can then have your service run the app to present the system tray icon etc. You can then pick your poison for service<>app comms, networking/messages etc.

Ok thank you that all sounds great sadly I’m not sure where to start on it. So I would have a separate application that the service somehow calls to create the notification for me? I’m not sure how to generate a system tray notification with a desktop application.

How does my service application open the desktop application and communicate with it?
How do I generate the little balloon tray notification with the desktop application?

HAHA I did a search for balloon notifications and all I found was a person linking to one of my old threads on the old forum where I made a custom notification window years ago. Maybe I’ll just do that instead but I’m still not sure how to call this from the service application.

As far as I can figure, the current Win 10 Notification Center requires the UWP New API. You are probably better off emulating the notification window.

See \Example Projects\Desktop\TrayItem for tray icon implementation

Damn, I’m turning into a sales man for MBS, is there anything they haven’t done already :wink:

Or you could look at the following to implement it yourself:

Time vs $$ :wink:

See for messaging between apps

Handling toast activations from Win32 apps in Windows 10

Have fun :smiley:

Thanks for all the help I appreciate it. I’ll give all this a look. Much appreciated! :slight_smile:

Ok so let’s say I have a desktop app that can create my own custom notification windows.

Then 1) How do I open it from within my service application?

and 2) How do I pass data between the service app and the notification app?

I guess I could just use the shell to launch the notification app and then have the service write to a shared database file that the notification app reads from.

Sure if you want, have the app start up, read the data, show a window then quit.

I wouldnt like to say what would happen then if someone isnt logged into the machine, worth a test :slight_smile:


But if you have a central database, just use that and a table for messages.


Thanks, those are all good thoughts. I will definitely take a look at checking for the logged in user first.

Hmm I’m wondering if Windows will have problems running the application because its being launched by a service. Hmmm.

This wasn’t a problem back in the day when I did it as you could get away with murder, security wise.

I might be better to have a tray app after all, have it auto start on user login and have it poll that database message table every now and again and show the popup.

Yeah that was my concern, as I’ve had a lot of security issues I’ve had to overcome with this system service. That’s why I made it clear I was trying to send Service Notifications in the title of the thread. I’ll try both ways and see what happens. Thanks.

Good thread here:

UGH just what I was afraid of. Services run in a sandbox. :confused:

TrayApp polling the db with a timer it is.