The situation: A DLL project with one class and one form
The DLL has a public function ShowList e.g. it reads a file and displays a
result in a listview in a form.
I can't kill the form because I need it for later use. Sometimes I need more
than one list (form).
At this point I have to kill the class by a button_click in a form. The
problem is, that some
references of the forms (no controls) remain in the class. That means the
class never runs
through the Terminate and never frees the allocated memory (not the
complete).
So my question is if anybody solved problems like this?
Is my solution wrong, or do I need some mysterious api-functions?
What is the "right" way, if there is any?
Dieter
Private Sub Class_Initialize()
Load MyForm
set m_frmWhatever = MyForm
End Sub
I'm assuming it's obvious m_frmWhatever is defined as private member at the
class scope like this:
Private m_frmWhatever As Form
Also, I'm assuming you've got your own implementations to display the form,
something like this:
Public Sub ShowMyForm()
m_frmWhatever.Show
End Sub
Finally, I had a little typo with the pointer assignment from class object
to client level var. Don't use parantheses to pass property as I had it.
' TYPO: Set frmDLLForm = oObj.FormList()
use it like this:
Set frmDLLForm = oObj.FormList
That should do it.
Bye now.
"Dieter Peters" <p...@rgu.de> wrote in message
news:e1TaxB7o$GA....@cppssbbsa02.microsoft.com...
Ok, I see... but I forgot to show the whole problem (depends on my English).
Let me try to explain again:
I have a project (ActiveX-DLL), one form, one class.
Then I need to have several instances of e.g. Form1 (in Class1: set
oForm(Index) = Form1)
Then each instanced form needs a reference to Class1 (in Form1: Public
cParent = Class1) because they use subs and functions in Class1.
The problem occurs when closing (unload) the forms and leaving Class1. I
think the problem depends on crossreferencing form and class. And this is
the (a) real problem...
Dieter