jt070397
asked on
Reusing forms as DLLs in non-Delphi applications
am trying to write a Delph-1-DLL with forms which should be opend by a
non-Delphi application as child windows of its client area.
So, I suppose, the
constructor create(AOwner: TComponent) and the
procedure CreateParams(var Params: TCreateParams)
of the derived class "TMyForm", have to perform the assignment of the non-Delphi
window to MyForm.Parent and MyForm.Owner. If "Hwnd" is the handle of the non-Delphi
window, the exported DLL procedure has the following form:
Procedure OpenMyForm (Hwnd: handle);
.
.
begin
.
.
AOwner := MakeOwnver (Hwnd);
MyForm := TMyForm.Create (AOwner);
.
.
But how can I create a variable of type TComponent, if I only know the handle of this non-Delphi window, that means, how works "MakeOwnver".
If this concept isn't right, please, explain the correct method.
Thanks.
non-Delphi application as child windows of its client area.
So, I suppose, the
constructor create(AOwner: TComponent) and the
procedure CreateParams(var Params: TCreateParams)
of the derived class "TMyForm", have to perform the assignment of the non-Delphi
window to MyForm.Parent and MyForm.Owner. If "Hwnd" is the handle of the non-Delphi
window, the exported DLL procedure has the following form:
Procedure OpenMyForm (Hwnd: handle);
.
.
begin
.
.
AOwner := MakeOwnver (Hwnd);
MyForm := TMyForm.Create (AOwner);
.
.
But how can I create a variable of type TComponent, if I only know the handle of this non-Delphi window, that means, how works "MakeOwnver".
If this concept isn't right, please, explain the correct method.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
MyForm does not become a real child window of the Parent window HWnd.
Painting works correct, it is minimized if its parent is minimized, it receives the messages create, activate and deactivate, but it will not be distroyed if the parent window is
closed.
if borderstyle is none and
Params.Style := Params.Style
or WS_CHILD OR WS_CLIPSIBLINGS
or WS_CLIPCHILDREN
the position is at 0,0 of the desktop, even if the parent is moved.
if borderstyle is none and
Params.Style := WS_CHILD OR WS_CLIPSIBLINGS
or WS_CLIPCHILDREN
the position is elsewhere within the parent window, but not at
defined (left,top).
Only if borderstyle is bsSizeable the position of MyForm is (left,top) relative to the parent.
Please, give more hints!
jt
Painting works correct, it is minimized if its parent is minimized, it receives the messages create, activate and deactivate, but it will not be distroyed if the parent window is
closed.
if borderstyle is none and
Params.Style := Params.Style
or WS_CHILD OR WS_CLIPSIBLINGS
or WS_CLIPCHILDREN
the position is at 0,0 of the desktop, even if the parent is moved.
if borderstyle is none and
Params.Style := WS_CHILD OR WS_CLIPSIBLINGS
or WS_CLIPCHILDREN
the position is elsewhere within the parent window, but not at
defined (left,top).
Only if borderstyle is bsSizeable the position of MyForm is (left,top) relative to the parent.
Please, give more hints!
jt
(Self as TWinControl).CreateParams(
with this:
inherited CreateParams(Params);