Re: Does VS2005 import XP icons properly? - found a workaround
- From: "bogdan" <bogdan@xxxxxxxxxx>
- Date: Wed, 21 Mar 2007 21:43:03 -0400
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
.
- References:
- Does VS2005 import XP icons properly?
- From: bogdan
- Re: Does VS2005 import XP icons properly?
- From: Tom Serface
- Re: Does VS2005 import XP icons properly?
- From: bogdan
- Re: Does VS2005 import XP icons properly?
- From: Tom Serface
- Re: Does VS2005 import XP icons properly?
- From: bogdan
- Does VS2005 import XP icons properly?
- Prev by Date: Can I use gdi+ in vs 6?
- Next by Date: Re: OnKeyDown not called for VK_DOWN or VK_RIGHT but is called for others.
- Previous by thread: Re: Does VS2005 import XP icons properly?
- Next by thread: Adding functionality to Outlook Express
- Index(es):
Relevant Pages
|