Hello,
I am a beginner using VC++6 Prof and Windows 98.

I am writing an MDI application and am currently writing the first
document/view scenario, which is a splitter with treeview/listview.

One of my menu options is a function which I am handling in the
document. In this I need a pointer to the listview, and my problem is
that I need to know how to get this pointer. What I have done is to
declare a pointer (called AddrPointer) in the document class
declaration, and then in the listview I did this:

void CAddrList1::OnInitialUpdate()
{
CListView::OnInitialUpdate();

// TODO: Add your specialized code here and/or call the base class
CAddrDoc1* tempdoc = (CAddrDoc1*)GetDocument();
tempdoc->AddrPointer = this;
}



I made the pointer equal to "this" in the listview class. I like this
method because the pointer is available permanently when the
document/listview is open.

I would like to know if this is a good method, because I have frequently
seen warnings in MSDN that some pointers are only temporary etc. etc..
Is there a possibility that under some circumstances this pointer is not
accessible?

I would be grateful for advice on the subject, and code snippets showing
what is the correct method if what I have done above is wrong.

Thanks,
Paul Trimming
--

----------------------------------
Email: [email protected]
Surrey, England
----------------------------------