FreeLibrary in ActiveForm
Posted on 2002-05-14
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.
In which events handlers I must place LoadLibrary & FreeLibrary stuff in my ActiveForm control???
Many thanks in advance,