 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
John Runyan Guest
|
Posted: Fri Jul 09, 2004 2:34 pm Post subject: Res files and Packages/Components |
|
|
I have a package "MyComponents" that contains "TMyComponent1",
"TMyComponent2", etc. I have added a bitmap, "MYBITMAP", to the
MyComponents.res file. If I understand the function of the res file its
contents is linked into the executable (bpl in this instance). So now
"MYBITMAP" is actually part of MyComponents.bpl.
At designtime I can access the bitmap using the following:
ABitMap->LoadFromReasourceName(__classid(TMyComponent1)), "MYBITMAP");
I add TMyComponent1 to a form and the Bitmap shows up. I then compile and
run the new application and I get the following error, "Resource
"MYBITMAP" not found".
Does "MyComponent.bpl need to be in a directory that is contained in a
search path? Or is there some other problem?
Thanks,
--
John Runyan
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Jul 09, 2004 7:29 pm Post subject: Re: Res files and Packages/Components |
|
|
"John Runyan" <jrunyan (AT) necassociates (DOT) com> wrote
| Quote: | I have a package "MyComponents" that contains
"TMyComponent1", "TMyComponent2", etc. I have
added a bitmap, "MYBITMAP", to the
MyComponents.res file.
|
You should not put any custom resources into IDE-managed files. Create a
separate .res file instead and then add it to the package.
| Quote: | If I understand the function of the res file its contents is linked
into the executable (bpl in this instance). So now "MYBITMAP"
is actually part of MyComponents.bpl.
|
Correct.
| Quote: | At designtime I can access the bitmap using the following:
ABitMap->LoadFromReasourceName(__classid(TMyComponent1)), "MYBITMAP");
|
LoadFromResourceName() expects a module instance handle, not a class meta
type. Use FindClassHInstance() to get the proper module handle:
ABitMap->LoadFromReasourceName(FindClassHInstance(__classid(TMyComponent1)),
"MYBITMAP");
| Quote: | Does "MyComponent.bpl need to be in a directory that is contained in a
search path?
|
If you are using dynamic linking, then yes. If you are using static
linking, then the BPI is compiled into the EXE directly and is not needed at
runtime at all.
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
|
|