The code in the client is
hRes = m_pIGenLicense->GenerateLicense(&product_version,
&file_version,&OS_version,1,&product_version);
if (hRes != S_OK)
{
_bstr_t temp;
CComPtr<IErrorInfo> pError;
CComBSTR strError;
GetErrorInfo(0, &pError);
pError->GetDescription(&strError);
temp = strError;
::MessageBox(NULL,temp, _T("Error"), MB_ICONEXCLAMATION);
}
The error occurs on the call to GetErrorInfo(&pError);
I admit I don't understand this part AT ALL and I was only able to
find one example, (which I tried to copy).
PS. The server class was derived from ISupportErrorInfo not
ISupportErrorInfoImpl as suggested by the books on the subject. I
have tried both with the same lack of results.
Complied with July 2000 Platform SDK and VC 6.0 SP 4 with ATLBASE.H
replaced by the one from the SDK.
Thanks for the help
-------------------------------------------
Roy Chastain
KMSystems, Inc.
CComPtr<IErrorInfo> pError;
Don't declare a smart pointer. Let the GetErrorInfo function allocate the
interface for you.
IErrorInfo* pError = NULL;
GetErrorInfo(0, &pError);
if(pError != NULL)
{
.... Get the description here.
}
pError->Release();
Good luck,
JD
Roy Chastain <r...@kmsys.com> wrote in message
news:2irb6t8m0nj8bik96...@4ax.com...
On Wed, 17 Jan 2001 14:01:37 -0600, "Jon Dahl" <jd...@technium.com>
wrote:
kb
"Roy Chastain" <r...@kmsys.com> wrote in message
news:2irb6t8m0nj8bik96...@4ax.com...
On Thu, 18 Jan 2001 08:43:54 -0500, "Ken Brady" <kbr...@ibes.com>
wrote:
In the server, create and set an error object like below:
ICreateErrorInfo* pcei;
IErrorInfo* pei;
HRESULT hr;
hr = CreateErrorInfo(&pcei);
hr = pcei->QueryInterface(IID_IErrorInfo, (LPVOID*) &pei);
if (SUCCEEDED(hr))
{
SetErrorInfo(0, pei);
pei->Release();
}
pcei->Release();
return E_FAIL;
In the client side, retrieve the erro object:
HRESULT hr;
IErrTest* pErrTest;
hr = ::CoCreateInstance(CLSID_ErrTest, NULL, CLSCTX_ALL, IID_IErrTest,
(void**)&pErrTest);
if (FAILED(hr))
return;
hr = pErrTest->CallException(); // An exception is generated in the server.
if (FAILED(hr))
{
ISupportErrorInfo *pSupport;
hr = pErrTest->QueryInterface(IID_ISupportErrorInfo, (void**)&pSupport);
if (SUCCEEDED(hr))
{
hr = pSupport->InterfaceSupportsErrorInfo(IID_IErrTest);
if (hr == S_OK) {
IErrorInfo *pErrorInfo;
hr = GetErrorInfo(0, &pErrorInfo);
if (SUCCEEDED(hr)) {
pErrorInfo->Release();
}
}
pSupport->Release();
}
}
I never run into the similar problem before. Just curious about how to
reproduce your problem.
-- Allen