Print Page | Close Window

Loading XP Icons from resource

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2884
Printed Date: 09 November 2025 at 12:38am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Loading XP Icons from resource
Posted By: andre
Subject: Loading XP Icons from resource
Date Posted: 13 September 2005 at 8:13am

Hi,

Is there anyway to load XP icons( not bitmaps ) from resource ?

Xtreme has a very nice function HBITMAP CXTPImageManagerIcon::LoadAlphaIcon(LPCTSTR pszFileName, int nWidth), but it only loads icons from a file.

I build my own LoadAlphaIcon( HINSTANCE h, LPCSTR sid, int w ), but I want to know if it is there anyway simpler to do it, because I had to add the icons to a diferent resource group than ICON.

myresource.rc

<..>

DELETE                IMAGE     DISCARDABLE     "res\delete.ico"

<..>

An this raises another question, why do Visual studio seems to damage( remove alpha layer ) on XP icons when they are added to the ICON group on the resource ?

Thankx

André moreira




Replies:
Posted By: Oleg
Date Posted: 13 September 2005 at 2:09pm

In 9.70 was added simple

SetIcon(IconId, CommandId)

That loads alpha icon.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: andre
Date Posted: 13 September 2005 at 2:58pm

Hi Oleg,

thankx,

But I did no found any sample that actualy loads a XP Icon( with alpha layer ) from the resource( RT_GROUP_ICON ), is there any sample ?

<...>

SetIcon( IDI_ICON, 0x100 ); // where IDI_ICON is a XP Icon

<...>

I did however found a lot of bitmap and toolbars examples but that's not what I need.

Actualy one of the reasons that I insist on icons and not bitmaps, is that the Icon is much easer to deal with and much smaller than bitmaps on the resource, ( it probably have some kind of compression ) ?

And also one the reasons I do not use SetIcon is because I think Visualstudio 6 does not like icons with alpha layer( not just 16milion  ), everytime I add one, the alpha layer is damaged.

That is why I need to see a sample to see how it's done.

André

 



Posted By: Oleg
Date Posted: 13 September 2005 at 11:53pm

Hi,

So SetIcon call don't work in your application? Can you attach ico file you use may be problem in it?

Don't open it in Visual Studio IDE and it won't damage it.

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: andre
Date Posted: 15 September 2005 at 2:29pm

Hi Oleg,

A small bug...

HBITMAP CXTPImageManagerIcon::LoadAlphaIcon(LPCTSTR pszFileName, int nWidth)
{

 HANDLE hFile = CreateFile(pszFileName, GENERIC_READ, 0, NULL,
  OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

 if (!hFile)
  return NULL;

should be...

 if (hFile==INVALID_HANDLE_VALUE)
  return NULL;

 

 




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