2013-02-12 59 views
1

我们有一个Delphi应用程序,它也是一个COM服务器,应用程序有一个主窗体。在自动模式下启动(smAutomation)时,我们需要创建主窗体作为父模板。由于这个问题范围之外的一些原因,我们不能创建应用程序,然后执行一个COM方法来重新恢复主窗体,即重建必须在整个过程中尽早完成 - 就在主窗体创建之后。欣赏想法thx。Delphi COM服务器初始化

编辑:澄清

// 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; 
+2

问题是怎么回事? – 2013-02-12 18:55:35

+0

我的意思是,你不能在你需要知道如何创建主表单的时候测试ComServer.StartMode吗? – 2013-02-12 19:16:17

+0

感谢您的及时回复,澄清(希望) – user2046977 2013-02-12 21:19:28

回答

0

我可以看到两个选项:

  1. 集Form1.ParentWindow:=例WHandle立即Application.CreateForm以下。
  2. 如果这太晚了,那么你将需要覆盖TForm1.CreateParams并将其设置在那里。