| View previous topic :: View next topic |
| Author |
Message |
Cactus Guest
|
Posted: Wed Dec 17, 2003 8:52 am Post subject: TApplication::Handle mistake. |
|
|
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
|
Posted: Wed Dec 17, 2003 6:03 pm Post subject: Re: TApplication::Handle mistake. |
|
|
"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
|
Posted: Wed Dec 17, 2003 6:13 pm Post subject: Re: TApplication::Handle mistake. |
|
|
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
|
Posted: Thu Dec 18, 2003 12:54 pm Post subject: Re: TApplication::Handle mistake. |
|
|
| 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
|
Posted: Thu Dec 18, 2003 7:04 pm Post subject: Re: TApplication::Handle mistake. |
|
|
"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 |
|
 |
|