tags:

views:

11

answers:

1

Hi,

I'm trying to call Error("My Test") in normal cpp class (Not a COM object, but this class will be used by COM). In the compilation, I get error saying

'Error': identifier not found

I have included #include in the cpp file. Please explain why it does not work.

NOTE: I can use Error() inside COM object successfully

Thank you

A: 

Error() is a static member function of CComCoClass. You could call it directly, but you would need to provide the template parameters which is not very convenient. Instead you can call AtlReportError() which is what Error() does internally.

sharptooth