Link to home
Start Free TrialLog in
Avatar of itamar
itamar

asked on

FreeLibrary in ActiveForm

Hi all,

I've developed a ActiveX control (TActiveForm) in Delphi 5 to be used only in Internet Explorer 5+ (HTML page).

In this OCX I have to dynamically load and unload a DLL, let's say MYDLL.DLL.

Firstly, I tried to place LoadLibrary in TMyFormX.Initialize, but I couldn't guess the right place to call FreeLibrary.

I now have LoadLibrary in TMyFormX.ActiveFormCreate and FreeLibrary goes into TMyFormX.ActiveFormDestroy

Using breakpoints I can see that FormCreate and Initialize are called many, many times, for example, HTML page reload, but I never could trace FormDestroy.

As I'm having some GPF's in I.E. and details tells me IEXPLORE bla bla bla (you know what I mean..) in MYDLL.DLL I'm very suspicious that LoadLibrary & FreeLibrary are not in right place.

The question:

In which events handlers I must place LoadLibrary & FreeLibrary stuff in my ActiveForm control???

Many thanks in advance,
Itamar
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

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 itamar
itamar

ASKER

Hi inthe,

bad news for me!

I have some good reasons to call external DLL's.
The load and unload in each function call probably will causes me performance problems, but I'll try anyway...

Really disapointed with ActiveX...
If TActiveForm has a initialize method that can be overridden, it should also have a finalize one!

Well, perhaps someone else can bring some other ideas to this thread, but if you are saying so, I'm not so hopefulness ;-)

Thanks a lot!
Itamar
Hi itamar,

not sure for ActiveX, but usually you can do it something like this:

unit SomeUnit;
...
interface
...
implementaion
...
initialization
  // load library here
finalization
  // unload library here
end.

Avatar of itamar

ASKER

Hi inthe,

your comment was the more usefull.

Thanks,
Itamar