Pergunta

I have an old VB6 app and whenever the user does the Alt-Tab thing, the dialog displays a generic icon instead of the application icon.

What can I do to display the proper icon in the Alt-Tab window?

Foi útil?

Solução

It needs a bit of additional work than just adding the icon to a form, but easy enough to do:

http://www.vbaccelerator.com/home/vb/tips/setting_the_app_icon_correctly/article.asp

Outras dicas

Each form has an "Icon" property you can set in the properties window to assign an icon. It sounds like this was used to set the icon on the main form, so your app's window looks correct.

However, there is also a project-level icon that is used for the Alt-Tab window and the taskbar. You set this on the "Make" tab of the "Project/Properties" dialog:

alt text

In the "Application" section, you can set the application's title, and use the dropdown list to assign one of the application's form icons to be the application icon. This is what will display in the Alt-Tab dialog and the taskbar.

Note that each form also has a "ShowInTaskbar" property that defaults to True. You should set this property to False for any non-modal forms in your app (other than the main form) to prevent them from displaying additional taskbar icons.

Finally, you should check the link on Adam Dempsey's answer to see how to support multiple icon resolutions. At the bare minimum, you can just create a 16x16 icon and attach it as described. Windows will handle the scaling, although you'll get some blurring when your icon is scaled up for higher resolutions.

though this years old - I had the problem and solved it, and the solution isn't shown here. Since this in one of the top Google responses, i thought i'd add it here.

If you have set the icon on the form and in the settings, and it still isn't showing - you may have set the "ShowIcon" form setting to false. When this is false, even if you have an icon attached - it won't show in the Alt-Tab menu.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top