Re: Does VS2005 import XP icons properly? - found a workaround

Tech-Archive recommends: Fix windows errors by optimizing your registry



The problem seems to be limited to dialog-based applications only. Large
and small icons are set by calling SetIcon() methods which in turn send
WM_SETICON messages. The on-line docs say that WM_SETICON takes as its param
either ICON_LARGE (0) or ICON_SMALL (1). I accidentally came across another
param constant ICON_SMALL2 (3) that is mentioned in WM_GETICON message
description. I then decided to give it a try and it worked. So, instead of
calling SetIcon(m_hIcon, ICON_SMALL) I call SetIcon(m_hIcon, ICON_SMALL2).
It works on W2K and XP. I can't understand why this is not documented.

I think that non-dialog apps work fine because the framework subclasses the
main window and attaches the icon to the new class. No explicit WM_SETICON
messages are sent to the window.

Bogdan


"bogdan" <bogdan@xxxxxxxxxx> wrote in message
news:uT6aNl8aHHA.2552@xxxxxxxxxxxxxxxxxxxxxxx
The same icon displays fine in a dialog box, though image displayed by the
dialog is 32x32.

The OS is also picking and displaying correct images from the exe file.
For example, Windows Explorer displays proper images when I browse the
app's folder (i.e. where the exe file is located). I tested it in all
views to make sure that large and small images are loaded properly.

Creating a shortcut to the app on the desktop and on the Quick Launch
toolbar works also fine. The last one is especially surprising because
I'd expect that the same icon image should be displayed on the task bar
when the app runs. This is not the case though.

The app is dialog based. The code that loads/sets the icon has been
auto-generated by the framework. I'm also using 32bpp icons in lists. No
problems there. It seems that the problem is limited to the main
application's icon and only when it is displayed on the title bar and/or
task bar.

Thanks again,
Bogdan


"Tom Serface" <tom.nospam@xxxxxxxxxxxxx> wrote in message
news:%234KEBD8aHHA.4176@xxxxxxxxxxxxxxxxxxxxxxx
I've never seen this happen, but I have tons of hi-res icons with alpha
channel being used. I'll try some tests today and see if I can reproduce
it... It certainly sounds like your icons should work. Have you tried
loading any of them just to display on a dialog to see what happens?

Tom

"bogdan" <bogdan@xxxxxxxxxx> wrote in message
news:ef5Niu7aHHA.4312@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for replying.

I've been very careful not to open the icon in VS. The following is
what I did:
1. Copied the icon file to app's res folder
2. Edited app's resource file (.rc) with notepad and put a reference to
the icon
e.g. IDR_MAINFRAME ICON "res\\ICS client.ico"
3. Deleted debug\release folders (including *.res files)
4. Opened the app's solution and rebuild it

Still, when the app runs, the icon on the title bar and on the desktop's
task bar is drawn with a lot of noise on the edges. One thing I noticed
is that - for whatever reason - the app does not pick up 16x16 image for
the title bar and the task bar. Instead, it renders 32x32 (I think)
image. So it could be that scaling the image creates the noise.

I tested the icon file from the app's res folder with a non-UI program
by modifying the program's shortcut on the desktop
(Properties.Shortcut.Change Icon...) and the icon seemed to work fine.
That is, the system picked up the correct (16x16) image for the title
bar and the task bar. There was no noise.

So, it looks like the framework is not picking up the correct image from
the icon file.

Any idea what could cause this?

Thanks,
Bogdan





.



Relevant Pages

  • Re: Dialog Application Doesnt Display Icon
    ... >I have a dialog based application that does not display an icon in the task ... >bar (by task bar I mean the active app menu in the bottom right corner). ... >with EVC 4 it will not have an icon in the task bar either. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: WM_SETICON and small icons
    ... Shows "2" in task bar ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ... Try splitting your icons into separate icon resources. ...
    (microsoft.public.win32.programmer.ui)
  • Re: [kde] OK -Im trying
    ... icon onto the desktop or onto the panel. ... But I can then close the app and drag it to the desktop folder, ... If I try to drag it to the task bar it crashes kicker Had ... systemsettings> Appearance tab> Fonts? ...
    (KDE)
  • Re: Cannot get AVG updates
    ... My AVG Icon in task bar is grey and I am unable to get the updates. ... but for some reason it hasn't actually installed it..maybe the download ... then reboot and install the new version. ...
    (uk.people.silversurfers)
  • Re: taskbar too many Icons
    ... The icons on the task bar represent programs that are ... running, and if the program is running, the icon will be there. ... the System Tray) which also sits on the Task ... decision about what you want to keep and what you want to get rid of. ...
    (microsoft.public.windowsxp.general)