Jump to content
mikerabat

tray notification dll delphi11.3/Delphi 2010

Recommended Posts

Following problem:

Our main platform for developing our applications is still D2010 (don't ask why..). One of our

applications we develop used to use the standard tray icon ballon hints which have a few problems

on newer platforms - win 11 especially.

 

So.. the task is to use the toast notification component from D11. To do that I ccreated a small dll that exports a function

returning an interface that handles the notification - basically show and cancel the hint.

 

There are some events that may happen in a rapid timing. I carefully designed the dll such that the notifications are only shown and hidden

in the main thread. The problem is that I encounter sometimes nasty access violations that I cannot account for...

 

 

Here is my theory:

Showing and hiding toast notifications through the winrt api somehow invokes something like Application.processmessages -

I can confirm that during the hide call the show call is reentered (since I put something from a thread in the message queue

that triggers a balloon hint to be shown) so either the show call or the hide call result in a nasty AV. (one call on the toastnotification center is not finished and 

the next one is already there...)

 

I tried to "wait" for the call to be finished but spin waiting blocks the notification stuff too and I actually do not want to have another

handler implemented in the d2010 app....

 

Has anyone experienced something like this (aka is there an easy solution)

 

Could a queue be a solution -> the main app just queues the call an in a message pump (wndproc of an allochwnd call) I handle it myself?

Any chance that some winrt init call is missing or can be done different such that it does not show that behaviour?

 

Attached the two files that account for the dll

 

kind regards

    Mike

 

 

notifyImpl.pas

trayNotifications.dpr

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×