Re: Question on how to debug COM
"ccccoder" <email@example.com> wrote in message
Well, the author is Microsoft, and there is no documentation for
that. At least, it's not telling what is passing in the pDispParams.
I'm developing an addin for Excel
I assume you have seen the documentation here and found it lacking:
What exactly do you believe is wrong with this documentation?
(actually, adding new features to an
existing one), we need to validate certain data before printing the
workbook. If the data can't be validated correctly, we want to cancel
the print job.
We had an event sink, and we can capture the print event. However, I
don't know how to make it cancel the print request. In VBA, I can set
the cancel flag to true in Workbook_BeforePrint, but in C++ (with
ATL/COM), we simply can't replace the equivalent of the
Why not? What's stopping you? Sink events from Workbook object, handle
So, as an investigation, I just want to see what is passed in by
Excel to my Invoke() method when the print event is fired.
According to the documentation at
you should get DISPPARAMS structure with a single VARIANT of type
VT_BOOL | VT_BYREF. This means that pboolVal member of this VARIANT
holds a pointer to VARIANT_BOOL variable. You should set that variable,
via the pointer, to VARIANT_TRUE if you want to cancel print operation.
Don't people need to know what kind of
IDispatch they receive, from time to time?
Perhaps. Note than, in a particular case of Workbook.BeforePrint event,
you don't receive any kind of IDispatch. Which, I guess, renders your
profound philosophical observation somewhat moot.
With best wishes,
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925