I don't have a definitive answer yet but I think I have narrowed down my problem. I started changed my TYPE structures to use CBSTR rather than WSTRING * MAX_PATH. Everything was going well until I suddenly noticed that the same string was displaying several times when it should have displayed a different string.
For this particular TYPE, once I switched the element back to use WSTRING * MAX_PATH then everything worked as normal again.
The only difference between this TYPE and my other TYPEs is that this one gets created using the NEW operator.
Dim pDoc As clsDocument Ptr
pDoc = New clsDocument
etc..
The first filename was stored correctly. (okay)
The second filename stored okay (okay)
The third was the same as the second (not okay)
The fourth was the same as the second and third (not okay)
I can only surmise that when NEW is used the memory pointer in the TYPE for the newly allocated structure still points to the memory address of the previous instance.
More testing is needed but keep your eyes open to this one. I guess it is no different than the case where you manually allocate memory (ALLOCATE or CALLOCATE) in a TYPE element and then use NEW for a new instance. You also need to manually allocate for the new instance. Something like "deep copying" in C++ maybe?
Try setting the BSTR pointer to null.
' ========================================================================================
' CBStr class destructor
' ========================================================================================
DESTRUCTOR CBStr
CBSTR_DP("CBSTR DESTRUCTOR")
IF m_bstr THEN SysFreeString m_bstr
m_bstr = NULL
END DESTRUCTOR
' ========================================================================================
Sorry Jose, that did not fix it. No big deal, just need to be aware.