Problem reporting the error information from an ATL component
From: Jaime Stuardo (jstuardo_at_manquehue.net)
Date: 12/02/04
- Next message: Jeff Henkels: "Re: regsvr32 :("
- Previous message: Thomas Noone: "Second try: How to open published Outlook form"
- Next in thread: Alexander Nickolov: "Re: Problem reporting the error information from an ATL component"
- Reply: Alexander Nickolov: "Re: Problem reporting the error information from an ATL component"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 2 Dec 2004 07:32:41 -0300
Hi all..
I need a component to send the error information to the client application
which was programmed, for example, in Visual Basic.
The interface implements ISupportErrorInfo this way:
public ISupportErrorInfoImpl<&IID_ISimuladorAPV>
and this is the method I want to report the error:
STDMETHODIMP CSimuladorAPV::GrabaAfiliado(long ID, long *pVal) {
HRESULT hr = S_OK;
if( m_pAfiliadoObj )
{
*pVal = m_pAfiliadoObj->Graba(ID);
if( *pVal == -1 )
{
hr = m_pAfiliadoObj->GetLastResult();
if( FAILED(hr) )
Error(T2CA((LPTSTR)m_pAfiliadoObj->GetLastError()),
IID_ISimuladorAPV, hr);
m_pAfiliadoObj->Release();
m_pAfiliadoObj = NULL;
}
}
return hr;
}
When an error occurs, Visual Basic recognizes the error code, but the error
message says that the method of ISumuladorAPV has failed.
By debugging, I know that the call to m_pAfiliadoObj->GetLastError() returns
the correct error message. Maybe the Error function doesn't make a copy of
the message so that when I call m_pAfiliadoObj->Release() the message text
is no longer valid?
Thanks
Jaime
- Next message: Jeff Henkels: "Re: regsvr32 :("
- Previous message: Thomas Noone: "Second try: How to open published Outlook form"
- Next in thread: Alexander Nickolov: "Re: Problem reporting the error information from an ATL component"
- Reply: Alexander Nickolov: "Re: Problem reporting the error information from an ATL component"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|