Print Page | Close Window

WINVER=0x500 yields jagged icon in CXTPTaskDialog

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=14405
Printed Date: 21 November 2024 at 4:06pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: WINVER=0x500 yields jagged icon in CXTPTaskDialog
Posted By: znakeeye
Subject: WINVER=0x500 yields jagged icon in CXTPTaskDialog
Date 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/



Replies:
Posted By: znakeeye
Date 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/


Posted By: Oleg
Date 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


Posted By: znakeeye
Date 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!
http://msdn.microsoft.com/en-us/library/ms648075.aspx - http://msdn.microsoft.com/en-us/library/ms648075.aspx
 
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/


Posted By: znakeeye
Date 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/


Posted By: Oleg
Date 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


Posted By: Oleg
Date 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


Posted By: znakeeye
Date 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/


Posted By: znakeeye
Date 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/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net