[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

MDI application with childwins in dll's

Hi!

I'm having a problem with an MDI application. The child windows are defined in a .dll or .bpl and I can't make it
work. In the .dll I have a function that shows the window and set's the application.handle property for the .dll to
the MDI-applications handle. When creating the window I get the following message:
    Project raised exception class EInvalidOperation with message 'Cannot create form. No MDI forms are
currently active'

Is it possible to do this? If it is, any ideas?
/Per
0
peed112097
Asked:
peed112097
  • 4
  • 3
  • 2
  • +1
1 Solution
 
JaccoCommented:
A bit more down the list Westy asks the same question!

Just a remark :)

I am looking into the problem.

Regards Jacco
0
 
peed112097Author Commented:
I've solved the problem when using a dll,but look into my other Q if you have any idea's there! I'll be deleting this Q soon!

/Per
0
 
JaccoCommented:
What was the solution?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
peed112097Author Commented:
Look at westys Q!
0
 
JaccoCommented:
I can't get your solution to work. Are you sure the MDI child form is not compiled into the main EXE? I get a resource error because the application handle is wrong.

Regards Jacco
0
 
peed112097Author Commented:
Ok, if you send me your e-mail address I'll mail the project to you. I'm sure that the child's not in the .exe.

0
 
JaccoCommented:
Jacco@HotelConcepts.COM

Thanks in advance!

Regards Jacco
0
 
Hagen040798Commented:
Hi peed

The answer for the problem is the same answer for your question with the dynamicly loading packages and includeds Objects.
I have for my Firma yust this programmed.
TForms in Librarys-DLL's and the Loading, Creation, Destroying and unloading from the Librarys at Runtime.
Post me your E-Mail-Address and i send your a Example from my Project.
my E-Mail is HaReddmann@AOL.COM

Hagen.

0
 
ThaddyCommented:
You might be interest in this little snippet.
Design your form, add action:=caFree to the formclose event!
and compile it in this dll framework. You call the dll form from your main app like so: ShowMDIChildForm(Application);

library MDIForms;
uses
  SysUtils, Classes,Forms,Windows,ChildU in 'ChildU.pas' {ChildForm};
var
  DLLApp : TApplication;
procedure MyDLLProc(Reason: Integer);
begin
  if Reason = DLL_PROCESS_DETACH then
    if Assigned(DllApp) then
      Application := DllApp;
end;
procedure ShowMDIChildForm(MainApp : TApplication);
var
  Child : TChildForm;
begin
  if not Assigned(DllApp) then begin
    DllApp := Application;
    Application := MainApp;
  end;
  Child :=TChildForm.Create(Application.MainForm);
  Child.Show;
end;
exports
  ShowMDIChildForm;
begin
  DllApp := nil;
  DLLProc := @MyDLLProc;
end.
0
 
Hagen040798Commented:
Hi Per.

Have You reseived me Mail ?

Hagen.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now