Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Loading XP Icons from resource
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Loading XP Icons from resource

 Post Reply Post Reply
Author
Message
andre View Drop Down
Groupie
Groupie


Joined: 09 March 2005
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote andre Quote  Post ReplyReply Direct Link To This Post Topic: Loading XP Icons from resource
    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

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 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
Back to Top
andre View Drop Down
Groupie
Groupie


Joined: 09 March 2005
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote andre Quote  Post ReplyReply Direct Link To This Post 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é

 

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 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
Back to Top
andre View Drop Down
Groupie
Groupie


Joined: 09 March 2005
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote andre Quote  Post ReplyReply Direct Link To This Post 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;

 

 

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.063 seconds.