Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - LoadBitmapFromResource finds wrong resource
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

LoadBitmapFromResource finds wrong resource

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

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 930
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: LoadBitmapFromResource finds wrong resource
    Posted: 11 January 2012 at 5:30pm
When I add PNG and BMP resources to my project the IDE separates the two types of images in the resource view. I have a "Bitmap" and a "PNG" entry. So far so good.
 
But the IDE can assign the same resource ID to a BMP and a PNG resource. When I call CXTPImageManager::SetIcons, LoadBitmapFromResource is called. There I see this:
 

hModule = AfxFindResourceHandle(lpszResource, _T("PNG"));

When I am debugging, I see that even if I pass in an ID that is used only on a BMP resource, the call succeeds. Hence, when I am trying to load a BMP resource for which a PNG resource has been assigned the same ID, the image manager will load the PNG and not the BMP and that can cause problems since the wrong image has been loaded.
 
My only work-around appears to be to manually edit the values in resource.h. Is there a better way?
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.047 seconds.