BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using resources in csustom components

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Dennis Jones
Guest





PostPosted: Fri Dec 10, 2004 5:16 pm    Post subject: using resources in csustom components Reply with quote



Hi,

I am writing a custom component that displays a bitmap. I am currently
loading the bitmap like this:

pBitmap->LoadFromResourceName( (unsigned int)HInstance, "MYBITMAP" );

This works fine at design time, but it fails at runtime with the message:
"Resource MYBITMAP not found."

What is the proper way to include resources in a package such that they are
available at design-time and runtime? In addition, it must be available
whether the package is statically linked or dynamically linked.

Can anyone help?

- Dennis


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Dec 10, 2004 6:13 pm    Post subject: Re: using resources in csustom components Reply with quote




"Dennis Jones" <djones (AT) nospamoregon (DOT) com> wrote


Quote:
I am writing a custom component that displays a bitmap. I am
currently loading the bitmap like this:

pBitmap->LoadFromResourceName( (unsigned int)HInstance, "MYBITMAP" );

You need to do this instead:

pBitmap->LoadFromResourceName(
FindClassHInstance(__classid(TMyComponent)), "MYBITMAP" );


Gambit



Back to top
Dennis Jones
Guest





PostPosted: Fri Dec 10, 2004 6:37 pm    Post subject: Re: using resources in csustom components Reply with quote



Interestingly Remy, my original attempt was based on a post you made quite a
long time ago!

After adding a "#pragma resource" statement into my component's CPP file,
this latest method worked great.

Thank you,

- Dennis

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote

Quote:

"Dennis Jones" <djones (AT) nospamoregon (DOT) com> wrote in message
news:41b9d9dc (AT) newsgroups (DOT) borland.com...

I am writing a custom component that displays a bitmap. I am
currently loading the bitmap like this:

pBitmap->LoadFromResourceName( (unsigned int)HInstance, "MYBITMAP" );

You need to do this instead:

pBitmap->LoadFromResourceName(
FindClassHInstance(__classid(TMyComponent)), "MYBITMAP" );


Gambit





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.