STDMETHODIMP CWorkshareMenu::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* lRet) { if ( NULL == lRet ) { LRESULT res; // Use dummy return for incoming messages without a pResult parameter return MenuMessageHandler ( uMsg, wParam, lParam, &res ); } return MenuMessageHandler ( uMsg, wParam, lParam, lRet ); }
STDMETHODIMP CBmpCtxMenuExt::HandleMenuMsg2 ( UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult ) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); // For messages that have no return value, pResult is NULL. This is // _very_ mean on the part of MS since it forces us to check whether // pResult is valid before using it. You'd think that a pointer to // a "return value" would always be valid, but alas no. // If it is NULL, I create a dummy LRESULT variable, so the code in // MenuMessageHandler() will always have a valid pResult pointer. if ( NULL == pResult ) { LRESULT res; return MenuMessageHandler ( uMsg, wParam, lParam, &res ); } else { return MenuMessageHandler ( uMsg, wParam, lParam, pResult ); } }
STDMETHODIMP CBmpCtxMenuExt::HandleMenuMsg ( UINT uMsg, WPARAM wParam, LPARAM lParam ) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); // res is a dummy LRESULT variable. It's not used (IContextMenu2::HandleMenuMsg() // doesn't provide a way to return values), but it's here so that the code // in MenuMessageHandler() can be the same regardless of which interface it // gets called through (IContextMenu2 or 3). LRESULT res; return MenuMessageHandler ( uMsg, wParam, lParam, &res ); }