I am developing an ActiveX-Control with Visual C++ ( i don't use ATL or
MFC ) for Visual Basic. I have only little experience with ActiveX-Controls
and no experience with VB. The ActiveX-Control-part works well with the
ActiveX-Control-Test-Container, but it hangs with VB if i add a
command-button to the form. The problem is, that when VB wants to save the
control it keeps calling the IPersistStreamInit::Save() function and it
doesn't stop. Here is how i implemented the IPersistStreamInit::Save()
function:
HRESULT STDMETHODCALLTYPE ImplIPersistStreamInit::Save( /* [unique][in] */
IStream *pStm, /* [in] */ BOOL fClearDirty )
{
char dummy[ 10 ] = { 0 };
ULONG NumBytesWritten = 0;
EDM_DebugMessage( "IPersistStreamInit-Interface: called Save." );
if ( pStm != NULL ) {
// actually write some dummy data to the stream
pStm -> Write( ( void* ) dummy, 10, &NumBytesWritten ); // write 10 bytes
AdviseHolder -> SendOnSave();
} else {
return( E_UNEXPECTED );
}
AdviseHolder -> SendOnSave();
return( S_OK );
}
What am i doing wrong? Is there some documentation like "Programming
ActiveX-Controls for Visual Basic in C++" What are the equirements a
ActiveX-Control must meet to work with VB. Because it works with the
Testcontainer i assume that i have to meet some special requirements for VB.
Thanks in advance for the help.
Thomas