U must make sure u destroy ur control correctly
1) check/debug your main ATL class destructor.
u may be doing something wrong there.
2) if u have threads running, make sure to stop them.
3) unload loaded DLLs
4) do u implement InPlaceActivate & InPlaceDeactivate method ?
see IOleInPlaceObjectWindowlessImpl && CComControlBase for details
exemple:
u should have in ur header :
STDMETHOD(InPlaceDeactivate)(void);
HRESULT InPlaceActivate(LONG iVerb, const RECT* prcPosRect = NULL)
{
return CComControlBase::InPlaceActivate(iVerb, prcPosRect);
}
and in ur cpp file :
STDMETHODIMP Cax3DPlugin::InPlaceDeactivate(void)
{
return IOleInPlaceObjectWindowlessImpl<Cax3DPlugin>::InPlaceDeactivate();
}