Return value of an ATL event
I my definition of the connection point interface I have this method:
[id(1), helpstring("method PageFormatted")] HRESULT PageFormatted([in] long pageNumber, [out, retval] BOOL* bRet);
The "interesting part" of the wizard-generated Fire_PageFormatted method is this:
CComVariant avarParams[1];
avarParams[0] = pageNumber;
avarParams[0].vt = VT_I4;
CComVariant varResult;
if(bRet)
{
varResult.byref = bRet;
varResult.vt = VT_BOOL|VT_BYREF;
}
DISPPARAMS params = { avarParams, NULL, 1, 0 };
hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL);
In the object which handles this event I have defined this handler:
BOOL __stdcall OnPageFormatted( long pageNumber );
And its _ATL_FUNC_INFO:
_ATL_FUNC_INFO OnPageFormattedInfo = {CC_STDCALL, VT_BOOL, 1, {VT_I4}};
I fire the event this way:
BOOL bRet = TRUE;
Fire_PageFormatted( (long) pgNum, &bRet );
But no matter what I return from the handler, the value of bRet is not updated.
Any thoughts what might be wrong?

