O
Onega
Hi
I have problem raising COM exception with
support_error_info("IMyinterface").
It is an ATL wizard generated COM Exe project(VC++2003)
My interface looks like:
[
object,
uuid("2FAE9160-300F-43F6-A90F-668A2A2EB7F0"),
dual, helpstring("IMyinterface Interface"),
pointer_default(unique)
]
__interface IMyinterface: IDispatch
{
[id(1), helpstring("method Test")] HRESULT Test([in] BSTR bsTestValue);
};
[
coclass,
threading("apartment"),
support_error_info("IMyinterface "),
event_source("com"),
vi_progid("Somthing.Something"),
progid("Somthing.Something.1"),
version(1.0),
uuid("D9DB6B19-6D07-4EEB-91A0-196059D5486E"),
helpstring("SomethingClass")
]
class ATL_NO_VTABLE Something:
public IMyinterface
{
STDMETHODIMP Test(BSTR bsTestValue)
{
if(true)
{
////////////////////I want to raise a COM exception here, how to do it?
/*The following code snippet works in non-attributed In-Proc COM project,
but under this situation it doesn't work as expected. I call my COM Server
via VBscript, the script engine only reports there is an unspecified error,
but not given detailed error message.
*/
IID IID_IMyinterface=__uuidof(IMyinterface);
ICreateErrorInfo *pcei = 0;
HRESULT hr = CreateErrorInfo(&pcei);
hr = pcei->SetGUID(IID_IMyinterface);
....
}
return S_OK;
}
}
Your suggestion is welcome. Thanks a lot.
In an online sample chapter of the book
COM Programming with Microsoft? .NET
Author Julian Templeman, John Paul Mueller
I found there is a chapter dealing with exception handling and attributed
programing. But I don't have this book on-hand. And the book is not
available locally.
Onega
I have problem raising COM exception with
support_error_info("IMyinterface").
It is an ATL wizard generated COM Exe project(VC++2003)
My interface looks like:
[
object,
uuid("2FAE9160-300F-43F6-A90F-668A2A2EB7F0"),
dual, helpstring("IMyinterface Interface"),
pointer_default(unique)
]
__interface IMyinterface: IDispatch
{
[id(1), helpstring("method Test")] HRESULT Test([in] BSTR bsTestValue);
};
[
coclass,
threading("apartment"),
support_error_info("IMyinterface "),
event_source("com"),
vi_progid("Somthing.Something"),
progid("Somthing.Something.1"),
version(1.0),
uuid("D9DB6B19-6D07-4EEB-91A0-196059D5486E"),
helpstring("SomethingClass")
]
class ATL_NO_VTABLE Something:
public IMyinterface
{
STDMETHODIMP Test(BSTR bsTestValue)
{
if(true)
{
////////////////////I want to raise a COM exception here, how to do it?
/*The following code snippet works in non-attributed In-Proc COM project,
but under this situation it doesn't work as expected. I call my COM Server
via VBscript, the script engine only reports there is an unspecified error,
but not given detailed error message.
*/
IID IID_IMyinterface=__uuidof(IMyinterface);
ICreateErrorInfo *pcei = 0;
HRESULT hr = CreateErrorInfo(&pcei);
hr = pcei->SetGUID(IID_IMyinterface);
....
}
return S_OK;
}
}
Your suggestion is welcome. Thanks a lot.
In an online sample chapter of the book
COM Programming with Microsoft? .NET
Author Julian Templeman, John Paul Mueller
I found there is a chapter dealing with exception handling and attributed
programing. But I don't have this book on-hand. And the book is not
available locally.
Onega