Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - WINVER=0x500 yields jagged icon in CXTPTaskDialog
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

WINVER=0x500 yields jagged icon in CXTPTaskDialog

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: WINVER=0x500 yields jagged icon in CXTPTaskDialog
    Posted: 28 May 2009 at 10:21am
I have a custom icon in my CXTPTaskDialog (not using Vista API). When I set WINVER=0x0500 the icon is drawn a la Windows 2000. The borders become jagged (i.e. no alpha blending). Note that I have included the needed manifest!
 
I believe your dialog uses the native icon drawing functions. This causes a problem in the above scenario.
PokerMemento - http://www.pokermemento.com/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2009 at 10:44am

The icon is loaded via this call: LoadImage(NULL, pFileName, IMAGE_ICON, cxIcon, cyIcon, flags);

Hmm, is this the root cause?
PokerMemento - http://www.pokermemento.com/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2009 at 1:52am

Hi,

We have standard DrawIconEx API call to draw it. so problem can be only in icon or way you load it. Try add LR_CREATEDIBSECTION  flag.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2009 at 11:07am
This is really strange. I don't think this has to do with CJ.
 
If I load ico-files with this API, and then put them in your toolbars, the alpha layer seems to be lost!
 
This worked a couple of months ago. Since then I've upgraded from 12.1.1 to 13.0.0. Perhaps MS updated a vital DLL somewhere? Don't get it...
 
Could you please try this?
 
HICON hIcon = NULL;
  UINT iconID = 0;
  if (PrivateExtractIcons("C:\\WINDOWS\\notepad.exe", 0, 16, 16, &hIcon, &iconID, 1, LR_COLOR))
  {
   iconID = XTPImageManager()->AddCustomIcon(hIcon);
   pButton->SetIconId(iconID);
   DestroyIcon(hIcon);
  }
 
The resulting image is screwed at the borders...
PokerMemento - http://www.pokermemento.com/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2009 at 11:27am

It's just like ComCtl32.dll v5.8 was being used... I don't get it! My code worked a couple of months ago...

Clearly, the manifest is not included in your dll. Just made a search for the public key token: 6595b64144ccf1df
Not found?
PokerMemento - http://www.pokermemento.com/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2009 at 1:57pm
Hi,
It have to be included to your exe - not to our dll.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2009 at 2:02pm
Hi,
 
Just tried with CustomThemes sample
 
 HICON hIcon = NULL;
 UINT iconID = 0;
 if (ExtractIconEx("C:\\WINDOWS\\notepad.exe", 0, 0,&hIcon, 1))
 {
  XTPImageManager()->SetIcon(hIcon, ID_FILE_OPEN);
  DestroyIcon(hIcon);
 }
Works well.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2009 at 3:23pm
Ok, but in my application the error is so obvious:
 
I load the icon and put it in my ribbon, and it looks great! Then, I use the same HICON in a CXTPTaskDialog and it gets an ugly border.
Either it has been scaled, or it is drawn incorrectly!
 
32x32 pixels...
 
This is a fact.
PokerMemento - http://www.pokermemento.com/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2009 at 7:54pm
Sorry for bothering you :P. It turned out my stupid icon was loaded as 48x48, which caused a resize...
 
Argh!
 
Anyway, thanks for your assistance!
PokerMemento - http://www.pokermemento.com/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.