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 

TApplication::Handle mistake.

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





PostPosted: Wed Dec 17, 2003 8:52 am    Post subject: TApplication::Handle mistake. Reply with quote



Hi

I'm mixed TApplication::Handle with Application variable.

Which is the ID of the running process?

When I making a Form use
new Form(AOwner);
the AOwner is "Application" variable or TApplication::Handle ?

Thanks.


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Dec 17, 2003 6:03 pm    Post subject: Re: TApplication::Handle mistake. Reply with quote




"Cactus" <a@b.com> wrote


Quote:
Which is the ID of the running process?

Neither. The Application variable itself is just a pointer to a global
instance of the TApplication class. Its Handle property is just an HWND
handle to a hidden window used as the parent window for all of the TForm
instances in the app and such.

Quote:
When I making a Form use
new Form(AOwner);
the AOwner is "Application" variable or TApplication::Handle ?

Just "Application", ie:

new TMyForm(Application);


Gambit



Back to top
René Wilhelmy
Guest





PostPosted: Wed Dec 17, 2003 6:13 pm    Post subject: Re: TApplication::Handle mistake. Reply with quote



Hi,

First, it's pretty more usual to instantiate a descendant of TForm that
is defined in the forms designer. Inside CBuilder is more the AOwner as
a TComponent value which "Application" or any Form is derived who is
used. The Application (or parent form)will be responsible for freeing it.
To instantiate a secondary form within your main form you can do:
//--using the hidden «this» pointer who point to your main form instance
TMyCoolForm *MyCForm = new TMyCoolForm(this);
MyCForm->Show();

Passing a window handle (HWND) will be (here I paste from the Help File):
«Pass a window handle as a parameter to embed the form in a non-VCL
window. This syntax is used when the form is implemented as an ActiveX
control that is embedded in a non-VCL window»

Rene Wilhelmy

Cactus a écrit:
Quote:
Hi

I'm mixed TApplication::Handle with Application variable.

Which is the ID of the running process?

When I making a Form use
new Form(AOwner);
the AOwner is "Application" variable or TApplication::Handle ?

Thanks.




Back to top
Cactus
Guest





PostPosted: Thu Dec 18, 2003 12:54 pm    Post subject: Re: TApplication::Handle mistake. Reply with quote

Quote:
When I making a Form use
new Form(AOwner);
the AOwner is "Application" variable or TApplication::Handle ?

Just "Application", ie:

new TMyForm(Application);

if the Form inside a DLL, it need host EXE send the Application to DLL? or
use

new TMyForm(NULL);



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Dec 18, 2003 7:04 pm    Post subject: Re: TApplication::Handle mistake. Reply with quote


"Cactus" <a@b.com> wrote


Quote:
if the Form inside a DLL, it need host EXE send the Application
to DLL? or use

new TMyForm(NULL);

I would suggest NULL. Just make sure that you actually free the form when
you are done with it, since it won't have an Owner to do it for you.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) 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.