Wrong icon gets rendered when directly running apps in terminal (double click exe to open terminal tab). #17492

Closed
opened 2026-01-31 05:44:11 +00:00 by claunia · 7 comments
Owner

Originally created by @AraHaan on GitHub (May 16, 2022).

Windows Terminal version

1.13.10984.0

Windows build number

10.0.22000.0

Other Software

My Discord Bot v2.1.100.

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

  1. 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?

Originally created by @AraHaan on GitHub (May 16, 2022). ### Windows Terminal version 1.13.10984.0 ### Windows build number 10.0.22000.0 ### Other Software My Discord Bot v2.1.100. 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 1. 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?
Author
Owner

@zadjii-msft commented on GitHub (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.

@zadjii-msft commented on GitHub (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: * #9458 * #1504 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.
Author
Owner

@AraHaan commented on GitHub (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

@AraHaan commented on GitHub (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
Author
Owner

@zadjii-msft commented on GitHub (May 16, 2022):

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.

@zadjii-msft commented on GitHub (May 16, 2022): 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.
Author
Owner

@DHowett commented on GitHub (May 16, 2022):

@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 commented on GitHub (May 16, 2022): @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
Author
Owner

@ghost commented on GitHub (May 16, 2022):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (May 16, 2022): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@DHowett commented on GitHub (May 16, 2022):

(Thanks for the report @arahaan!)

@DHowett commented on GitHub (May 16, 2022): (Thanks for the report @arahaan!)
Author
Owner

@AraHaan commented on GitHub (May 16, 2022):

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?

@AraHaan commented on GitHub (May 16, 2022): > 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?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17492