I don't see these extra "signatures" that you are talking about. Are these
"John" <John@discussions.microsoft.com> wrote in message
news:C701F49C-FA2D-4231-81AF-1B9A407C80C7@microsoft.com...
This may be a strange question, but I was wondering if at ATL object has
to
return an HRESULT, for instance say I have the following in method in an
IDL
file
interface ISomeObj : IDispatch
{
[propget, id(1), helpstring("focal length")] HRESULT A([out, retval]
DOUBLE* pVal);
}
I would rather have
interface ISomeObj : IDispatch
{
[id(1), helpstring("focal length")] double A(void);
}
This would make using the object easier to use in the following case;
CComPtr<ISomeObject> pobj;
pobj.CoCreateInstance(CLSID_ISomeObj);
double a, d = 10;
HRESULT hr = pobj->get_A(&d);
if SUCCEEDED(hr) d *= a;
I would rather be able to use the following syntax
d *= pobj->A();
You can get very close to the above syntax. Instead of
HRESULT hr = get_A(&d);
you can use:
double d = GetA ();
I'm assuming that you used:
#import "SomeObject.dll" no_namespace
somewhere in your code. Just look at the contents of the generated
SomeObject.tlh file that is found in your Debug or Release folder and you
will see these extra signatures defined. Note that if there is an error
found that an exception is thrown, so typically you would code:
try
{
double d = GetA ();
}
catch (_com_error e)
{
}
HTH,
Brian