/// <summary> /// Wait X milliseconds for the graph to receive the EC_COMPLETE /// </summary> /// <param name="msTimeout">number of milliseconds to timeout before returning, or -1 for INFINITE</param> /// <returns> /// Complete - Operation completed. /// ErrorAbort - Error. Playback cannot continue. /// UserAbort - User terminated the operation. /// Unbuilt - Cannot execute this method /// 0 - graph is still running /// </returns> public EventCode WaitForCompletion(int msTimeout) { if (_mediaEvent != null) { EventCode e; int hr = _mediaEvent.WaitForCompletion(msTimeout, out e); if (DsError.Succeeded(hr)) { return(e); } else { return(0); } } return(EventCode.Unbuilt); }
void TestNotifyWindow() { int hr; EventCode ec; // Allow windows messages to be processed do { Application.DoEvents(); hr = m_mediaEventEx.WaitForCompletion(100, out ec); } while (hr == -2147467260); // timeout errors DsError.ThrowExceptionForHR(hr); // m_bCalled should get set in the WndProc routine Debug.Assert(m_bCalled, "SetNotifyWindow"); }