Handling opening a WPF application via protocol from another WPF application multiple times.

Alex1347

New member
Joined
Feb 4, 2025
Messages
4
Programming Experience
1-3
I open WPF application “A” via protocol from another WPF application “B”, I can handle this event in application “B”, using for example as in this code

C#:
if (activatedEventArgs != null)
{
    app.OnProtocolActivated(activatedEventArgs);
}

but it is triggered only on the first call of the opening event via protocol, I need that after the application has been opened via protocol and remains open that this event handler is triggered the next times.
 
If you use the protocol from the command line or a web browser, does your application B get the other events?

Basically, trying to narrow down the issue whether it is on the receiving end (B), or on the sending end (A).
 
If you use the protocol from the command line or a web browser, does your application B get the other events?

Basically, trying to narrow down the issue whether it is on the receiving end (B), or on the sending end (A).

No, when I try to use the protocol from a web browser I get the same result, no event works except “Activated”, but I don't get the necessary protocol information in the “Activated” handler.

The problem is more likely to be on the recipient (B) side, as WPF can't handle repeated triggering of this protocol event, so I'm looking for a workaround or alternative way.
 
First simplify. Instead of using a WPF app as the target, use a WinRT, WinUI, or whatever the current framework du jour that Microsoft has that was actually designed to accept URL activation. (I don't think WPF was designed to handle URL activation -- you'd need to jump through some hoops to get it registered and working as I vaguely recall reading.) If the simple WinRT app can accept multiple activations, then that would provide a clue. If it doesn't accept multiple activations, then that's also a clue.
 
Back
Top Bottom