Link to home
Start Free TrialLog in
Avatar of liferily
liferily

asked on

Quick Reports in DLL

I want to put a quick report form in a DLL.
It works fine but for one problem.
When I close the form the application calling the DLL freezes.
I create/destroy the QR form dynamically etc. The Standard delphi form is OK, as are database connnections, its just this QR form !!!
Avatar of Lischke
Lischke

Mmmh, how do you create the form? Do you set Application as owner? Have you passed in the application handle from the main application to the DLL?

Ciao, Mike
Avatar of liferily

ASKER

I have not passed the application handle explicitly. I will look at that next..

I have created a standard delphi form
(application owned)

from that I create a QR form
(application owned)

I destroy the QR form after previewing it, then destroy the standard form after showing it

I get to FreeLibrary(Handle); at which point it freezes - trying to free the library.
AFAIK, the problem is that the DLL as well as the main application create their own TApplication object. If you now create the form in the DLL with the TApplication object from there and try to free it from your main application then the wrong TApplication object is used.

Not sure if that's the true problem, but try either to allocate and free all forms belonging to the DLL only in the DLL or make both TApplication objects the same (preferably the main appl. stays...).

Ciao, Mike
I have just passed the application handle in a quick test app

It appears to work !!!!!

I will go back to a more involved program and check it out in more depth.

If all goes OK the points are yours if you want them - Do you need to post an answer ????

Cheers Lischke,

liferily.
I think you've hit the handle on the head (sort of pun!).

The forms were all created and destoyed within the DLL, however I don't think I was using the correct application handle within the DLL.

Like I've just said I'll have a more in-depth investigation...
ASKER CERTIFIED SOLUTION
Avatar of Lischke
Lischke

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