直接显示 SetNotifyWindow 函数

Direct Show SetNotifyWindow function

来自 sourceforge 我已经下载了一些示例来帮助我使用 Direct Show library.In 他定义了一个常量(将其用作地址)以在 SetNotifyWindow 中使用的代码我不明白为什么要引用我们最终定义的某些消息。

常量(消息):

 // Application-defined message to notify app of filtergraph events
 public const int WM_GRAPHNOTIFY = 0x8000 + 1;

媒体事件属性:

// provides method to retrieve the events 
IMediaEventEx mediaEventEx;

SetNotifyWindow 函数使用这个地址:

 //set the notify window
        //(NB:hr-->hresult (com device error for more http://msdn.microsoft.com/en-us/library/windows/desktop/dd375623%28v=vs.85%29.aspx)
        int hr = mediaEventEx.SetNotifyWindow(ptr, WM_GRAPHNOTIFY, IntPtr.Zero);

您正在设置通知。你告诉 FGM 在你应该进行一些处理时发回给你什么消息。

来自MSDN on IMediaEventEx::SetNotifyWindow

When the window receives the message, it should call the IMediaEvent::GetEvent method to retrieve the event. Events are asynchronous, so the queue might contain several events (or none). Call GetEvent repeatedly, until it returns an error code.