?
Solved

showing a dll form in a panel in main app

Posted on 2004-03-22
11
Medium Priority
?
976 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +4
11 Comments
 
LVL 27

Assisted Solution

by:kretzschmar
kretzschmar earned 200 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 200 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 17

Assisted Solution

by:geobul
geobul earned 200 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 200 total points
ID: 10663403
0
 

Assisted Solution

by:michaenh
michaenh earned 200 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

800 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