Article ID: 122488
Article Last Modified on 12/8/2003
/* Compile options needed: standard MFC OLE project generated by AppWizard*/
void CMyObject::Exception()
{
m_nIDContext = <some context>;
m_nSomeCode = <some code>;
AfxThrowOleDispatchException(m_nSomeCode,"String",m_nIDContext);
}
short CMyObject::GetError()
{
// From here you can use the member variable code
// and context to start WinHelp or do whatever
// help code you need to do ...
AfxGetApp()->WinHelp(m_nIDContext);
return m_nSomeCode;
}
Sub Command1_Click ()
On Error GoTo EHandle
Dim a As object
Set a = CreateObject("TestAuto")
' Next line causes exception:
a.exception
EHandle:
Msg = "The error message for error number "
Msg = Msg & Err & " is:" & NL & NL
Msg = Msg & """" & Error(Err) & """"
MsgBox Msg ' Display message.
' Next line starts WinHelp engine by calling method in server.
a.GetError
Exit Sub
End SubAdditional query words: 1.00 1.50 2.00 2.50 3.00
Keywords: kbtshoot kbinterop kbautomation kbprb KB122488