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 

Res files and Packages/Components

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





PostPosted: Fri Jul 09, 2004 2:34 pm    Post subject: Res files and Packages/Components Reply with quote



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





PostPosted: Fri Jul 09, 2004 7:29 pm    Post subject: Re: Res files and Packages/Components Reply with quote




"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
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.