
MFC + ATL: throwing an error back to VB
Hello,
Has anybody got a complete and simple example on how one can generate an
exception from VC++ 6 that will be catched by VB. I would very much
I am trying with AfxThrowOleDispatchException(0,"ERROR",0); but I catch
nothing error in VB.
I have been looking a lot in msdn, codeguru... and I could not find clear
explanation with a complete example throwing error back to VB.
My code in VC++ is straightforward :
STDMETHODIMP CRaiseErrorObj::DivideBy0()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
AfxThrowOleDispatchException(0,"ERROR...",0);
return S_FALSE;
Quote:
}
and in VB :
Sub test()
Dim o As RaiseErrorObj
On Error GoTo HandleError
Set o = New RaiseErrorObj
o.DivideBy0
Set o = Nothing
Exit Sub
HandleError:
MsgBox Err.Description
End Sub
Many thanks in advance,
Michael