Solved

showing a dll form in a panel in main app

Posted on 2004-03-22
11
939 Views
Last Modified: 2011-04-14
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;
0
Comment
Question by:Darth_helge
  • 2
  • 2
  • 2
  • +4
11 Comments
 
LVL 27

Assisted Solution

by:kretzschmar
kretzschmar earned 100 total points
ID: 10648425
is your dllForm borderless??
0
 
LVL 5

Author Comment

by:Darth_helge
ID: 10648463
yes
0
 
LVL 5

Accepted Solution

by:
delphized earned 100 total points
ID: 10649571
I tried a similar way to do things, but I had a lot of strange problems. So I decided that you can't do things that are not supposed to be done with Delphi. I think this is due to Borland attitude towards the encapsulation of windows functions, that sometime is done in a odd and stupid way (see printer.pas for reference).

anyway goodluck ;-P
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 17

Assisted Solution

by:geobul
geobul earned 100 total points
ID: 10655676
Hi,

If it's suitable to you I would suggest using packages instead of dlls.

http://community.borland.com/article/0,1410,27178,00.html

Regards, Geo
0
 
LVL 11

Assisted Solution

by:shaneholmes
shaneholmes earned 100 total points
ID: 10663403
0
 

Assisted Solution

by:michaenh
michaenh earned 100 total points
ID: 10666736
Hi

How to support the keyboard for forms that are stored in a DLL and are docked on a control of the application? It seem that it can not get focus on any components or use the Tab, Arrow key in the dll form that have been docked or used as show instead of showmodal?

One could use pakages or frames instead of dll(as GEO mention.. ).
ex. frames:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20431534.html

I am also interested if anyone have any solution to the dll's problem in delphi.
kretzschmar, GEO.. :)

cheers,
mha
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10666788
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 ;-)
0
 
LVL 5

Author Comment

by:Darth_helge
ID: 10667009
the borderstyle is bsnone and the formstyle is fsnormal
0
 
LVL 1

Expert Comment

by:Extase
ID: 11282039
the use of SetParent API could solve the focus & keys problems,
SetParent(DLLForm.Handle, MainPanel.Handle);

0
 

Expert Comment

by:michaenh
ID: 11293598
Hi I believe I have tried setparent...

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

cheers,
mha
0
 
LVL 1

Expert Comment

by:Extase
ID: 11295839
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
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Printing problem 2 95
Unique identifier on a terminal server (rdp) 4 55
Graphics32 under Delphi 10.1 Berlin 2 68
Delphi Seattle StructureView color 1 5
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question