Hi, I have a problem getting a return value from an ATL event.
I my definition of the connection point interface I have this method:
The "interesting part" of the wizard-generated Fire_PageFormatted method is this:Code:[id(1), helpstring("method PageFormatted")] HRESULT PageFormatted([in] long pageNumber, [out, retval] BOOL* bRet);
In the object which handles this event I have defined this handler:Code: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);
And its _ATL_FUNC_INFO:Code:BOOL __stdcall OnPageFormatted( long pageNumber );
I fire the event this way:Code:_ATL_FUNC_INFO OnPageFormattedInfo = {CC_STDCALL, VT_BOOL, 1, {VT_I4}};
But no matter what I return from the handler, the value of bRet is not updated.Code:BOOL bRet = TRUE; Fire_PageFormatted( (long) pgNum, &bRet );
Any thoughts what might be wrong?




Reply With Quote