You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong icon gets rendered when directly running apps in terminal (double click exe to open terminal tab). #13111
On my Discord bot, it is designed to have an application icon. However when Windows Terminal is configured to be the default console host, all terminal tabs do not render the application icon when you directly double click it's executable file to run it.
Steps to reproduce
Build an .NET Console application with an *.ico file for the program's icon, then double click the built output so it launches in Windows Terminal.
Expected Behavior
For the icon of the application to be rendered on the tab. On MacOS it renders the icon just fine, however that is in Apple's terminal.
Actual Behavior
A different icon is rendered and is provided from the OS or some other application instead?
Cant one use the Windows API to obtain the icon information from the program that terminal is about to run (when it determines the program is about to execute directly) in order to use that information to simulate a profile with the icon?
Yea probably. Trick there is converting the HANDLE that returns into something that can be used as the source for a XAML icon. If you can figure that out, the rest of this probably isn't too hard to wire up.
Mike Griese (@zadjii-msft) I'm comfortable calling this a dupe of both of those issues. The description for "pass LNK/EXE data" suggests making a fake runtime profile for the handed-off application, and part of that would be making sure it's got the right icon. We do both, we get icons!
Yea probably. Trick there is converting the HANDLE that returns into something that can be used as the source for a XAML icon. If you can figure that out, the rest of this probably isn't too hard to wire up.
On Winforms what I do is convert the HANDLE to an System.Drawing.Icon, and then convert the icon to an Bitmap, use the bitmap and icon for what I needed. I guess here could do something similar but have the bitmap saved to an temp bitmap file then try loading it as an XAML icon?
Activity
zadjii-msft commentedon May 16, 2022
Huh. Coulda swore we were tracking this somewhere, but doesn't look like it. #10669 looks vaguely related, but that's not it.
For this to work, we'd probably need to some set of:
we need to both be able to get the info on what the icon was supposed to be, and the ability to turn icons in dll's and exe's into XAML icons.
AraHaan commentedon May 16, 2022
Cant one use the Windows API to obtain the icon information from the program that terminal is about to run (when it determines the program is about to execute directly) in order to use that information to simulate a profile with the icon?
edit: something like https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadimagew
zadjii-msft commentedon May 16, 2022
Yea probably. Trick there is converting the
HANDLEthat returns into something that can be used as the source for a XAML icon. If you can figure that out, the rest of this probably isn't too hard to wire up.DHowett commentedon May 16, 2022
Mike Griese (@zadjii-msft) I'm comfortable calling this a dupe of both of those issues. The description for "pass LNK/EXE data" suggests making a fake runtime profile for the handed-off application, and part of that would be making sure it's got the right icon. We do both, we get icons!
/dup #9458 #1504
DHowett commentedon May 16, 2022
(Thanks for the report AraHaan!)
AraHaan commentedon May 16, 2022
On Winforms what I do is convert the HANDLE to an System.Drawing.Icon, and then convert the icon to an Bitmap, use the bitmap and icon for what I needed. I guess here could do something similar but have the bitmap saved to an temp bitmap file then try loading it as an XAML icon?
Wire up passing LNK/EXE data from OpenCon to ITerminalHandoff (#13570)
Wire up passing LNK/EXE data from OpenCon to ITerminalHandoff (#13570)