// Filter graph events public void HandleGraphEvent(GraphEventCallback pCB) { if (pCB == null) { throw new COMException("No callback set", E_Pointer); } if (m_pEvent == null) { throw new COMException("No event pointer", E_Unexpected); } EventCode evCode = 0; IntPtr param1, param2; // Get the events from the queue. while (Succeeded(m_pEvent.GetEvent(out evCode, out param1, out param2, 0))) { // Invoke the callback. pCB.OnGraphEvent(evCode, param1, param2); // Free the event data. int hr = m_pEvent.FreeEventParams(evCode, param1, param2); DsError.ThrowExceptionForHR(hr); } }