I have a OCX written in MFC/VC6.
In this OCX I #import a Com DLL and use _com_ptr_t::CreateInstance to
get a smart pionter.
The DLL uses #import <msado15.dll> and CreateInstance, and little else
other than some WinSock code.
I use this OCX in a VB6 app, and it's OK.
When I try and use it in in a VB.net application everything works fine
(all functionality in DLLs OK, all functionality in OCX OK). I can
even use my VB7.net app as the executeable for debugging and step
through the OCX and see everything working as expected.
When the VB.net application is closed, everything is disposed, the
window disapears, and an unhandled exception is reported.
The exception occurs in something called "BroadcastWindow".
I have been all over the place looking for documentation on this
"BroadcastWindow" and found little.
If I comment out the #import, CreateInstance, and all smart pionter
calls (from the OCX), the problem disappears. No exception occures.
I thought it maybe a problem with Unintialising COM too early, but
(all) the code suggests not. I have even tried calling
CoFreeUnusedLibraries in the OCX ControlClass destructor to no avail.
I have tried recompiling all the compnents in VC7 (.net) as I thought
it could be problems with versions of MFC/CRT. They all compiled, but
the problem presists.
I am starting to pull my hair out on this one a little. Any help
would be greatly appriciated. Even any further light that can be
thrown on the fundamental cause of the problem could at least help me
start looking for possible solutions/alturnatives.
TIA
Simon Jones