Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Taskbar pinning on Windows 11 #69

Closed
caesay opened this issue Apr 14, 2022 · 4 comments
Closed

Taskbar pinning on Windows 11 #69

caesay opened this issue Apr 14, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@caesay
Copy link
Member

caesay commented Apr 14, 2022

I have not seen this issue myself but it was reported on Discord that the AppUserModelId is not working correctly on Windows 11. After an update, clicking a pinned shortcut launches the app, but a second icon appears (the new process does not get grouped with the shortcut). This seems to be the case even if SetProcessAppUserModelId is used in OnEveryRun.

Another possible issue on Win11 is that the Uninstaller DisplayVersion does not seem to be updated. I am wondering if this is a failure to update the registry key, or if Win11 UI is caching this somewhere and failing to update the UI until a restart.

@caesay caesay added the bug Something isn't working label Apr 14, 2022
@remco1271
Copy link

Did a quick try on windows 11

[DllImport("shell32.dll")]
public static extern void GetCurrentProcessExplicitAppUserModelID([Out(), MarshalAs(UnmanagedType.LPWStr)] out string AppID);

The script in my program:

private void OnAppRun(SemanticVersion version, IAppTools tools, bool firstRun)
{
    string AppID = string.Empty;
    NativeMethods.GetCurrentProcessExplicitAppUserModelID(out AppID);

    AppIDReport(AppID, version, false);
    tools.SetProcessAppUserModelId();
    AppIDReport(AppID, version, true);
}

private void AppIDReport(string str, SemanticVersion version, bool afther)
{
    if (str == null)
    {
        str = "!NULL!";
    }
    if (afther)
    {
        Log.Information("New AppID: " + str + " Version: " + version.ToString());
    }
    else
    {
        Log.Information("Old AppID: " + str + " Version: " + version.ToString());
    }
}

But I see that OnAppRun is only run during the install of the program.
On install the Log reports:

Old AppID: !NULL! Version: 1.0.37
New AppID: com.squirrel.CanBus_Monitor.CanBusMonitor Version: 1.0.37

On the next run of the program it doesn't run the OnAppRun and the AppID is NULL
My project is running .NET 6.0

@caesay
Copy link
Member Author

caesay commented Apr 17, 2022

I have fixed the OnAppRun hook in 2.9.23-gc8da1a but I have not confirmed that it fixes the shortcut pinning issue.

@remco1271
Copy link

The pinning for Windows 11 is now working

@caesay
Copy link
Member Author

caesay commented Apr 21, 2022

Thanks for looking into this @remco1271 !

@caesay caesay closed this as completed Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants