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 

Resource.

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





PostPosted: Tue May 04, 2004 5:04 pm    Post subject: Resource. Reply with quote



I am trying to use the resource from a package, but I am getting some error.
Anyone have some idea?

I am trying this on the component source:

Qgraphics::TBitmap *temp = new Qgraphics::TBitmap();
temp->LoadFromResourceName((unsigned int) HInstance, "BARRA01NOVO");

Thanks
Arnaldo Giacomitti Junior.


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue May 04, 2004 5:54 pm    Post subject: Re: Resource. Reply with quote



"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote


Quote:
I am trying to use the resource from a package, but I am getting some
error.


You need to be more specific. What is the actual error you are seeing?

Quote:
Qgraphics::TBitmap *temp = new Qgraphics::TBitmap();
temp->LoadFromResourceName((unsigned int) HInstance, "BARRA01NOVO");

If you are trying to load a resource from a package, then you need to use
the package's particular HInstance, not the global HInstance which is set to
the application process instead. Have a look at the FindClassHInstance()
function, ie:

temp->LoadFromResourceName(FindClassHInstance(__classid(TMyComponent)),
"BARRA01NOVO");


Gambit



Back to top
Arnaldo Giacomitti Junior
Guest





PostPosted: Tue May 04, 2004 6:10 pm    Post subject: Re: Resource. Reply with quote



I have put some icons on the resource of my package, and in my component
TBarraDados I wanna get those icons to load in TBarraDados

I have tryed

TImageList *ilIcones = new TImageList(this);
Qgraphics::TBitmap *temp = new Qgraphics::TBitmap();
temp->LoadFromResourceName( FindClassHInstance(__classid(TBarraDados)),
"BARRA01NOVO"); // this is line 26..
ilIcones->Add(temp, NULL);
Images = ilIcones;


But I got:
[C++ Error] QBarraDados.cpp(26): E2303 Type name expected
[C++ Error] QBarraDados.cpp(26): E2121 Function call missing )

Thanks.


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

Quote:

"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote in message
news:4097cd11 (AT) newsgroups (DOT) borland.com...

I am trying to use the resource from a package, but I am getting some
error.

You need to be more specific. What is the actual error you are seeing?

Qgraphics::TBitmap *temp = new Qgraphics::TBitmap();
temp->LoadFromResourceName((unsigned int) HInstance, "BARRA01NOVO");

If you are trying to load a resource from a package, then you need to use
the package's particular HInstance, not the global HInstance which is set
to
the application process instead. Have a look at the FindClassHInstance()
function, ie:


temp->LoadFromResourceName(FindClassHInstance(__classid(TMyComponent)),
"BARRA01NOVO");


Gambit





Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue May 04, 2004 6:19 pm    Post subject: Re: Resource. Reply with quote


"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote


Quote:
Qgraphics::TBitmap *temp = new Qgraphics::TBitmap();

Why are you using QT? Are you trying to write a CLX component and not a VCL
one? If so, then you are in the wrong newsgroup, you should be asking in
the CLX newsgroups instead.

Quote:
[C++ Error] QBarraDados.cpp(26): E2303 Type name expected

On which line exactly? You need to be more specific.


Gambit



Back to top
Arnaldo Giacomitti Junior
Guest





PostPosted: Tue May 04, 2004 6:31 pm    Post subject: Re: Resource. Reply with quote

This line is giving the error...
temp->LoadFromResourceName(
FindClassHInstance(__classid(TBarraDados)),"BARRA01NOVO");



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

Quote:

"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote in message
news:4097dc94$1 (AT) newsgroups (DOT) borland.com...

Qgraphics::TBitmap *temp = new Qgraphics::TBitmap();

Why are you using QT? Are you trying to write a CLX component and not a
VCL
one? If so, then you are in the wrong newsgroup, you should be asking in
the CLX newsgroups instead.

[C++ Error] QBarraDados.cpp(26): E2303 Type name expected

On which line exactly? You need to be more specific.


Gambit





Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue May 04, 2004 7:35 pm    Post subject: Re: Resource. Reply with quote


"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote


Quote:
This line is giving the error...
temp->LoadFromResourceName(
FindClassHInstance(__classid(TBarraDados)),"BARRA01NOVO");

Given the code you have shown so far, the only way that line can produce the
error you claim is if the TBarraDados class type is not known to the
compiler. Which is impossible if you have placed the code inside the
TBarraDados class to begin with.

Please show a more complete code snippet that shows exactly how you are
trying to use that code.


Gambit



Back to top
Arnaldo Giacomitti Junior
Guest





PostPosted: Thu May 06, 2004 12:09 pm    Post subject: Re: Resource. Reply with quote

Ok, I have got it to run, but every time he show the message can't found
BARRA01NOVO resource, I have put it in .res of component, in a .res of same
name of my class, use "#pragma resource "TBarraDados.res" and didn't work
too.
Any idea?

Thanks
Arnaldo.
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> wrote

Quote:

"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote in message
news:4097e193 (AT) newsgroups (DOT) borland.com...

This line is giving the error...
temp->LoadFromResourceName(
FindClassHInstance(__classid(TBarraDados)),"BARRA01NOVO");

Given the code you have shown so far, the only way that line can produce
the
error you claim is if the TBarraDados class type is not known to the
compiler. Which is impossible if you have placed the code inside the
TBarraDados class to begin with.

Please show a more complete code snippet that shows exactly how you are
trying to use that code.


Gambit





Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu May 06, 2004 6:52 pm    Post subject: Re: Resource. Reply with quote


"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote


Quote:
Ok, I have got it to run, but every time he show the message can't
found BARRA01NOVO resource

Again, I ask you to please show your actual code.

Quote:
I have put it in .res of component, in a .res of same name
of my class, use "#pragma resource "TBarraDados.res"
and didn't work too.

How did you create the .res file to begin with? Why are you using #pragam
instead of simply adding the .res file to the project via the "Add To
Project" option?


Gambit



Back to top
Arnaldo Giacomitti Junior
Guest





PostPosted: Fri May 07, 2004 6:17 pm    Post subject: Re: Resource. Reply with quote

I have only make a few tests with resource, I have created .res with borland
image editor,
and add some bitmap..... and try it with pragma and add to project too...
and have put the .res in some directory of package and with the same name
of component (TBarraDados.res)

Thanks
Arnaldo.

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

Quote:

"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote in message
news:409a2b04 (AT) newsgroups (DOT) borland.com...

Ok, I have got it to run, but every time he show the message can't
found BARRA01NOVO resource

Again, I ask you to please show your actual code.

I have put it in .res of component, in a .res of same name
of my class, use "#pragma resource "TBarraDados.res"
and didn't work too.

How did you create the .res file to begin with? Why are you using #pragam
instead of simply adding the .res file to the project via the "Add To
Project" option?


Gambit





Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri May 07, 2004 6:38 pm    Post subject: Re: Resource. Reply with quote

"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote


Quote:
I have only make a few tests with resource, I have created .res
with borland image editor, and add some bitmap..... and try it
with pragma and add to project too... and have put the .res in
some directory of package and with the same name of
component (TBarraDados.res)

For the third time now, I have to ask you to please show your actual code
that is trying to use the resource. Not just the line of code that actually
loads the resource, but the surrounding code that is actually trying to use
the resource as well.


Gambit



Back to top
moi
Guest





PostPosted: Mon Aug 16, 2004 11:57 am    Post subject: Re: Resource. Reply with quote

Remy Lebeau (TeamB) wrote:

Quote:
"Arnaldo Giacomitti Junior" <arnaldo (AT) giacomitti (DOT) com.br> wrote in message
news:409bd298 (AT) newsgroups (DOT) borland.com...


I have only make a few tests with resource, I have created .res
with borland image editor, and add some bitmap..... and try it
with pragma and add to project too... and have put the .res in
some directory of package and with the same name of
component (TBarraDados.res)


For the third time now, I have to ask you to please show your actual code
that is trying to use the resource. Not just the line of code that actually
loads the resource, but the surrounding code that is actually trying to use
the resource as well.


Gambit



Hi Remy,

I have the same problem, see below my code (component classname =
TDisplay) :

my TDisplay constructor :

TResourceStream* TransponderAOE = new
TResourceStream(FindClassHInstance(__classid(TDisplay)), "MyFont",
"RT_RCDATA");

my RC file :

MyFont RT_RCDATA "FONT_NAME.TTF"

Thanks Surprised)

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Aug 16, 2004 5:28 pm    Post subject: Re: Resource. Reply with quote


"moi" <labeteprods (AT) _no_spam_free (DOT) fr> wrote


Quote:
TResourceStream* TransponderAOE = new
TResourceStream(FindClassHInstance(__classid(TDisplay)), "MyFont",
"RT_RCDATA");

Your third parameter is wrong. Remove the quotation marks:

TResourceStream* TransponderAOE = new
TResourceStream(FindClassHInstance(__classid(TDisplay)), "MyFont",
RT_RCDATA);

Quote:
my RC file :

That file is wrong as well. It should be more like this:

MyFont RCDATA "FONT_NAME.TTF"


Gambit



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Aug 17, 2004 8:13 am    Post subject: Re: Resource. Reply with quote


"görgh" <labeteprods (AT) _no_spam_free (DOT) fr> wrote


Quote:
I've tried to used a valid res file form another component
and I obtain the same result : resource "" is not found.
What the matter ?

Is that the exact error message? If so, then it is saying that you did not
specify a resource name at all. Please show your exact code.


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.