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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
Hi inthe,
your comment was the more usefull.
Thanks,
Itamar
your comment was the more usefull.
Thanks,
Itamar
ASKER
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