【发布时间】:2015-06-02 17:39:31
【问题描述】:
我正在开发 WPF 4.5 中的 WinForms 替换应用程序。
当前的 WinForms 应用从 C++ 组件流式传输视频。 C# WinForms 控件有这样的代码:
public void StartVideoStream(int iCamera)
{
if (InvokeRequired)
{
delStartVideoStream del = new delStartVideoStream(StartVideoStream);
Invoke(del, new object[] { iCamera });
}
else
{
if (!VideoPlaying)
{
int iSuccess = ClientComm.StartVideoStream(iCamera, ucVideoPlayer.Handle,
(ClientComm.streaming_protocols)Properties.Settings.Default.VideoStreamProtocol,
Properties.Settings.Default.VideoStreamFrameRate);
if (iSuccess != 0)
{
Debug.WriteLine("[ucVideo] Could not play video.");
}
}
else
{
ClientComm.SelectVideoStream(iCamera);
}
VideoPlaying = true;
}
}
您可以看到它将其句柄传递给 COM 组件,该组件将视频直接写入它。
问题在于 WPF 中的控件没有句柄。在 WPF 中我该怎么做?
谢谢。
【问题讨论】:
标签: c# wpf video-streaming