0

enter image description here

How can I get a custom ID/Name for my WinUI3 program with notifications? Each time I start the unpacked program through the debugger or the .exe itself from any location, it creates a random GUID like "{A67659DD-0AD9-4430-BCE0-9658AD0E69EC}" under the path:

HKEY_USERS(SID)\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\

As I want to manage the registry keys and their values, I want to have a custom ID/Name here. I see other apps like "SentinelOne.WinAgent" there. Does anyone have an idea how this is possible?

I didn't find any information or example C# code about that.

In my appxmanifest, I have the following ({MyApp} is a placeholder):

<Extensions>
    <desktop:Extension Category="windows.toastNotificationActivation">
        <desktop:ToastNotificationActivation ToastActivatorCLSID="EC6E9BC5-CFE6-4740-BDD8-53C497EE57CF" />
    </desktop:Extension>
    <!-- Register COM CLSID -->
    <com:Extension Category="windows.comServer">
        <com:ComServer>
            <com:ExeServer Executable="{MyApp.exe}" DisplayName="{MyApp}" Arguments="--AppNotificationActivated">
                <com:Class 
                    Id="EC6E9BC5-CFE6-4740-BDD8-53C497EE57CF" 
                    DisplayName="{MyApp}" 
                    EnableOleDefaultHandler="true" 
                    ProgId="{My.App}" 
                    VersionIndependentProgId="{My.App.1}"
                    AutoConvertTo="00000000-0000-0000-0000-000000000000"
                    InsertableObject="false"/>
            </com:ExeServer>
        </com:ComServer>
    </com:Extension>
</Extensions>

Also, I have the following set:

<Application Id="{MyApp}">

The AppNotificationManager:

public void Init()
{
    AppNotificationManager notificationManager = AppNotificationManager.Default;
    notificationManager.NotificationInvoked += OnNotificationInvoked;

    notificationManager.Register();

    m_isRegistered = true;
}

If someone need more code or Iformations just aks please!

2
  • I don't think that will be possible. But I'm not very sure about that. Maybe you will need to ask in Github-github.com/microsoft/microsoft-ui-xaml/issues Commented Oct 30, 2024 at 3:01
  • I found a Solution. You can set "int result = SetCurrentProcessExplicitAppUserModelID(appId);" to a Custom appID. Commented Oct 31, 2024 at 8:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.