我做了一个程序的主界面左边用的是Treeview控件,右边想用DLL文件做对话框,中间是分割控件,请问如何将对话框加到主界面的右边.谢谢.

解决方案 »

  1.   

    把DLL窗体嵌入到父窗口的PANEL控件上:
    function LoadForm(Ahandle:Thandle;Aowner:TComponent;str:string;
        AParent:TPanel):LongInt;stdcall;
    var
      DLLForm:TFormModal;
    begin
      APPlication.Handle:=Ahandle;
      if GetClass(str)<>nil then
      begin
         DLLForm:=TFormModalClass(FindClass(str)).Create(Aowner,AParent);
         try
           windows.SetParent(DLLForm.Handle,AParent.Handle);//这一句很重要
           DLLForm.Show;
           Result:=LongInt(DLLForm);
         except
           DLLForm.Free;
         end;
      end;
         result:=LongInt(DLLForm);
    end;
      

  2.   

    这样做可能会导致DLL窗体上的某些控件对消息的相应有问题。