We have a Delphi application which is also a COM server, the application has a main form. When started in automation mode (smAutomation) we need to create the main form as parented. For several reasons outside the scope of this question we can't create the application and then execute a COM method to reparent the main form, namely reparenting has to be done very early in the process - right after the main form is created. Appreciate ideas thx.
Edit: Clarification
// Initialized as as an Application
if COMserver.startmode = smStandalone
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
End
Else
// Initialized as an automation server
if COMserver.startmode = smAutomation
Begin
// How do I set a Parent window handle property - this is called imediately after the COM client initializes the server
// how do I modify this call to create Form1 with a parent?
Application.CreateForm(TForm1, Form1);
End;
ComServer.StartMode
at the point you need to know how to create the main form? – David HeffernanParentWindow
orParent
? Why can't you assign to those properties after callingCreateForm
? It's still far from clear to me. – David HeffernanParentWindow := WHandle
immediately followingApplication.CreateForm
? If that's too late, then you will need to overrideTForm1.CreateParams
and set it in there. – David Heffernan