Windows - bad icon behavior

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Windows - bad icon behavior

Post by Jive Dadson »

Anyone ever see this? You have a wxWidgets program foo.exe. In Windows Explorer, you click foo.exe. The program opens and the icon appears in the taskbar. Now pin it to the taskbar, and the proper icon turns into the little white rectangle with the blue rectangle in it. Un-pin it, and the proper icon re-appears!

I am bamboozled. I fear that deep in the guts of the program (a big one) something is corrupting something. Programer hell.

Windows 7 64 bit
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Re: Windows - bad icon behavior

Post by Jive Dadson »

wxWidgets 3.3.0
Visual C++ 2017
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Windows - bad icon behavior

Post by PB »

These is silly question but still:

Can the behaviour be observed on multiple PCs? Sometimes (most of the times?) the corrupted icons are on Windows, sometimes something like this may happen too.

Also are you sure that your icons are correct at all their sizes, I'm not sure but perhaps a different icon is used for the pinned application than for a non-pnned one. The pinned icons are stored in %appdata%/Microsoft/Internet Explorer/Quick Launch/User Pinned/Taskbar

If the issue manifests on multiple computers, I assume it has started to do so only recently. Perhaps you could do something like git bissect to pinpoint the change which is causing this?

BTW, there is no wxWidgets 3.3.0, I assume you mean 3.0.3...
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Re: Windows - bad icon behavior

Post by Jive Dadson »

The icons are fine.

I have two minimal "Hello world" programs. One does what it is supposed to. The other screws up. I am trying to figure out what the difference is. I thought it was that the good one uses the old MACRO tables and the bad one uses Bind. But that was not it.

Onward through the fog.
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

End of Wits

Post by Jive Dadson »

I am at my wit's end. The program "minimal" in the samples that ship with wx works just fine.

I made a new solution/project and used minimal.cpp for the source code, exactly. I meticulously went through the properties and changed everything to be just like the working version, except of course I expanded relative file paths. So it would seem that I have too projects that differ only in the directory where they are located.

I deleted the Window Icon cache.

The danged this still misbehaves the same way. I can move it into the wx samples directory and it still misbehaves. Maybe the wx samples projects inherit something magical?

I am at a loss for what to do next.

Added later.

I copied the entire minimum project into a new "solution". I edited only two lines in the properties, to wit, I expanded the relative paths for include files and library search paths. NO JOY. The is reeeeediculous.
Last edited by Jive Dadson on Sun Aug 20, 2017 8:43 am, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Windows - bad icon behavior

Post by doublemax »

Can you upload the exe somewhere?
Use the source, Luke!
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Re: Windows - bad icon behavior

Post by Jive Dadson »

Sure. Hold on a sec
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Re: Windows - bad icon behavior

Post by Jive Dadson »

Here's the .exe

It requires 3.0.3 dlls

https://github.com/JiveDadson/minimal-wx
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Windows - bad icon behavior

Post by doublemax »

There is no icon in the resource.
Use the source, Luke!
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Re: Windows - bad icon behavior

Post by Jive Dadson »

It uses an external file which is in the github repository. I will do one tomorrow or the day after that uses an embedded resource.

Watch this space
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Windows - bad icon behavior

Post by doublemax »

Loading an external icon only works for things that happen at runtime, e.g. setting the icon for a frame. But there are also icons that Windows fetches from the executable when the program is not running, e.g. to display its icon in the Explorer window. These must be in the resource.
Use the source, Luke!
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Re: Windows - bad icon behavior

Post by Jive Dadson »

Okay, I uploaded one to github that has an embedded resource for the icon. Thanks for looking into this.

Same place https://github.com/JiveDadson/minimal-wx

BUT HOLD OFF. I think I am close to figuring it out. Pilot error of course.
Last edited by Jive Dadson on Sun Aug 20, 2017 1:53 pm, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Windows - bad icon behavior

Post by doublemax »

I uploaded one to github that has an embedded resource for the icon
No, it doesn't. How did you do it?

Check <wxdir>/include/wx/msw/wx.rc

This line sets the icon.

Code: Select all

// First wx icon in alphabetical order, so it will be used by Explorer if the
// application doesn't have any icons of its own
wxICON_AAA                      ICON "wx/msw/std.ico"
Use the source, Luke!
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Re: Windows - bad icon behavior

Post by Jive Dadson »

wxICON_AAA ?

I am totally confused. I have an icon named Foo.ico
How do I embed it as a resource? Pretend you are teaching a small child. :-)
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Re: Windows - bad icon behavior

Post by Jive Dadson »

I am still befuddled. But I think I am not adding/building the resource correctly.

Sorry for the false alarm.
Last edited by Jive Dadson on Sun Aug 20, 2017 2:19 pm, edited 1 time in total.
Post Reply