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 

Can i do this????

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
Vertuas
Guest





PostPosted: Thu Jan 13, 2005 6:55 pm    Post subject: Can i do this???? Reply with quote




Hi all,


The application I am working on uses Runtime packages, therefore any
components I write have to be supplied in a runtime package (gggrrrrrr).

Now I want to include some bitmaps in my components to make them look
pretty, but I don't want lots on .bmp file hanging around. All the
component in my packages have to be created at runtime, as some of the
packages act as "plugins" to the main application.

What is the best way of including a bitmap in a runtime package and being
able to use it?? The tow methods I can think of are causing problems :-

1) somehow store the bitmap info as a string value and load this value into
a tbitmap when needed. Can't do this as I cannot directly manipulate the
bitmap data very easily.

2) Store the bitmap as a resource in the .bpl and use
tbitmap.LoadResourceName(). This would be the better solution if it is
possible. If it is possible how do I get a handle to the runtime package?
Can I store the bmp in the .DCR file and access it?

Please help

Kind Regards

Vertuas




Back to top
Rob Kennedy
Guest





PostPosted: Fri Jan 14, 2005 12:50 am    Post subject: Re: Can i do this???? Reply with quote



Vertuas wrote:
Quote:
The application I am working on uses Runtime packages, therefore any
components I write have to be supplied in a runtime package (gggrrrrrr).

No they don't. Simply remove the components' run-time packages from your
project's package list, and the units will be compiled into the EXE instead.

Quote:
2) Store the bitmap as a resource in the .bpl and use
tbitmap.LoadResourceName(). This would be the better solution if it is
possible. If it is possible how do I get a handle to the runtime package?
Can I store the bmp in the .DCR file and access it?

The current module's handle is always given by the HInstance global
variable. When in a package, it will be the package's handle. When the
same unit is compiled into the EXE, it will give the EXE's handle.

Each unit should have its own resource file, which it includes via a $R
compiler directive.

--
Rob

Back to top
Vertuas
Guest





PostPosted: Fri Jan 14, 2005 9:12 am    Post subject: Re: Can i do this???? Reply with quote



Hi Rob

Thanks for that info, i will see if i can put it to good use!

Kind Regards

Vertuas


"Rob Kennedy" <me3 (AT) privacy (DOT) net> wrote

Quote:
Vertuas wrote:
The application I am working on uses Runtime packages, therefore any
components I write have to be supplied in a runtime package (gggrrrrrr).

No they don't. Simply remove the components' run-time packages from your
project's package list, and the units will be compiled into the EXE
instead.

2) Store the bitmap as a resource in the .bpl and use
tbitmap.LoadResourceName(). This would be the better solution if it is
possible. If it is possible how do I get a handle to the runtime
package?
Can I store the bmp in the .DCR file and access it?

The current module's handle is always given by the HInstance global
variable. When in a package, it will be the package's handle. When the
same unit is compiled into the EXE, it will give the EXE's handle.

Each unit should have its own resource file, which it includes via a $R
compiler directive.

--
Rob



Back to top
VBDis
Guest





PostPosted: Sat Feb 05, 2005 3:59 am    Post subject: Re: Can i do this???? Reply with quote

Im Artikel <guzFd.816$x95.652 (AT) newsfe6-win (DOT) ntli.net>, "Vertuas"
<vertuas@[nospam]callistocs.freeserve.co.uk> schreibt:

Quote:
2) Store the bitmap as a resource in the .bpl and use
tbitmap.LoadResourceName(). This would be the better solution if it is
possible. If it is possible how do I get a handle to the runtime package?

A runtime package basically is a DLL and can be handled like a DLL, even if
it's filename has a different extension. You also may use dedicated Resource
DLLs instead of packages, see Resource DLL in online help.

DoDi

Back to top
AlanGLLoyd
Guest





PostPosted: Sat Feb 05, 2005 7:32 am    Post subject: Re: Can i do this???? Reply with quote

In article <34ojbeF4d89uaU1 (AT) individual (DOT) net>, Rob Kennedy <me3 (AT) privacy (DOT) net>
writes:

Quote:
Each unit should have its own resource file, which it includes via a $R
compiler directive.


Vertuas should note that the Delphi re-generates a resource file named "<unit
name>.res" at each compile, and so you should not use this name for your
resource file. Use any other name and add a "{$R MyResFileName.res}" directive
to your unit.

I usually add a comment containing the contents of the .rc file immediately
below the $R compiler directive in the unit.

I find that resource access is "twitchy" and needs the resource names and types
to be in upper case.

Alan Lloyd
[email]alanglloyd (AT) aol (DOT) com[/email]

Back to top
Rob Kennedy
Guest





PostPosted: Sat Feb 05, 2005 7:46 pm    Post subject: Re: Can i do this???? Reply with quote

AlanGLLoyd wrote:
Quote:
Vertuas should note that the Delphi re-generates a resource file
named "<unit name>.res" at each compile, and so you should not use
this name for your resource file. Use any other name and add a "{$R
MyResFileName.res}" directive to your unit.

No, it regenerates a file named "<project name>.res" at each compile.
Using the name of the unit is fine -- encouraged, even.

--
Rob

Back to top
AlanGLLoyd
Guest





PostPosted: Sat Feb 05, 2005 8:31 pm    Post subject: Re: Can i do this???? Reply with quote

In article <36km54F534ttlU1 (AT) individual (DOT) net>, Rob Kennedy <me3 (AT) privacy (DOT) net>
writes:

Quote:
No, it regenerates a file named "<project name>.res" at each compile.
Using the name of the unit is fine -- encouraged, even.


Thanks, Rob

You're absolutely correct - I was suffering from Brain Access Violation <g>

Alan Lloyd
[email]alanglloyd (AT) aol (DOT) com[/email]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc 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.