 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Dennis Jones Guest
|
Posted: Fri Dec 10, 2004 5:16 pm Post subject: using resources in csustom components |
|
|
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
|
Posted: Fri Dec 10, 2004 6:13 pm Post subject: Re: using resources in csustom components |
|
|
"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
|
Posted: Fri Dec 10, 2004 6:37 pm Post subject: Re: using resources in csustom components |
|
|
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 |
|
 |
|
|
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
|
|