本文介绍了如何使用MCI打开视频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道如何打开视频文件,这是我的代码:

-用于导入dll:

Dont know how to open video files,this is my code:

-for importing dll:

[DllImport("winmm.dll")]
private static extern long mciSendString(
    string command,
    StringBuilder returnValue,
    int returnLength,
    IntPtr winHandle);



-用于附加视频文件:



-for oppening video file:

mciSendString("open \"" + fileName + "\" type mpegvideo alias mf style child parent " + this.VideoOutput, null, 0, IntPtr.Zero);


VideoOutput = PictureBox1.Handle.ToString()
如果我尝试构建新的应用程序,则代码有效,但在旧的应用程序中则无法工作(之前的代码有效)
请帮忙,我真的需要这个


VideoOutput = PictureBox1.Handle.ToString()
Code works if i try building a new application,but doesn''t work in my old app(code worked before)
Please help,I really need this

推荐答案


open D:\Temp\myVideo.mp4 type mpegvideo alias mf style child parent System.Windows.Forms.PictureBox, SizeMode: Normal

,因为PictureBox.ToString生成

since PictureBox.ToString generates

System.Windows.Forms.PictureBox, SizeMode: Normal


而根据 MSDN [ ^ ]父级应该是窗口的句柄.您可以尝试使用this.VideoOutput.Handle,因为它可能会产生更好的结果,但是我还没有尝试过,也不知道它是否会工作.


Whereas according to MSDN[^] the parent should be a handle to a window. You could try using this.VideoOutput.Handle, as it might give a slightly better result, but I haven''t tried it, and don''t know if it will work.



这篇关于如何使用MCI打开视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-23 16:57