Link to home
Start Free TrialLog in
Avatar of Darth_helge
Darth_helge

asked on

showing a dll form in a panel in main app

My form A will call another TCustomForm from a DLL and place it on a panel in the main program.
But when I do this my dbgrids don't behave like they should. I can't navigate with my up_key and down_key.

I know that if rewrite the code and shows the tcustomform in the dll as showmodal the dbgrids behave perfect.
How can I do this when the form is hooked to the panel in the mainform too?

In Main (where I call the form):

ShowDllIRForm(MainForm.Handle).ParentWindow := MainPanel.Handle;
ShowDllIRForm(MainForm.Handle).Show;


In DLL (returns the form):

function ShowDllIRForm(hApp: THandle): TCustomForm; stdcall;
begin
 Application.Handle := hApp;
  if not assigned(IRForm) then
    IRForm := TIRForm.Create(Application);
  result := IRForm;
end;
SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Darth_helge
Darth_helge

ASKER

yes
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
well,

i myelf didn't done a form in a dll,
therefore i can't point directly to thats it.

i know there are problems to embed bordered forms,
thats why i asked, if it is a borderless form.

as it is a borderless form, i'm out of ideas

will do a bit recherche

meikl ;-)
the borderstyle is bsnone and the formstyle is fsnormal
the use of SetParent API could solve the focus & keys problems,
SetParent(DLLForm.Handle, MainPanel.Handle);

Hi I believe I have tried setparent...

Could you show a small example of the code.. ?
Have you tried it?

cheers,
mha
here's some snippets from a project i'm working on

IProjectMgr = interface
  ['{B5427304-4D62-478A-99DF-3228F2185038}']
   function CreatePluginForm(const PluginClass:TPluginFormClass;const AOwner:TComponent;
                                             const AParent:TWinControl;const Sender:TObject):TPluginForm;
end;

IProjectMgr is implemented in TProjectMgrForm as follows:

function TProjectMgrForm.CreatePluginForm(const PluginClass:TPluginFormClass;const AOwner:TComponent;
                                             const AParent:TWinControl;const Sender:TObject):TPluginForm;
begin
  Result:=PluginClass.Create(AOwner) as TPluginForm;
  with Result do
  begin
     BorderStyle:=bsNone;//can be set at design time
     Windows.SetParent(Handle, AParent.Handle);
     Align:=alClient;
     Show;
  end;//with
end;

the Application(Host Application) is passed to the plugin DLL in the exported register procedure, so the plugin can get the interface IProjectMgr and calls CreatePluginForm passing to the Host App the PluginClass,and the creation of the pluginform is handled in the host application.

//still have only one problem ,. the align property of child controls in the plugin form, does'nt work correctly.
//everything else is OK