如何使用MCI打开视频文件 [英] How to open video files using 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
推荐答案
尝试检查以下链接:
http://social.msdn.microsoft.com /Forums/zh-CN/gametechnologiesaudioxact/thread/c6b79853-07c2-4382-9826-6932b958142b/ [ http://stackoverflow.com/questions/733324/help-with-mci-video-window [ ^ ]
Simple MCI Player [
try to check following links:
http://social.msdn.microsoft.com/Forums/en-US/gametechnologiesaudioxact/thread/c6b79853-07c2-4382-9826-6932b958142b/[^]
http://stackoverflow.com/questions/733324/help-with-mci-video-window[^]
Simple MCI Player[^]
regards
robert
我真的不认为您还不了解这一点,对吗?
发送到mci设备的命令字符串将评估为以下内容:
I really don''t think you quite understand this yet, do you?
Your command string sent to the mci device will evaluate to something along teh lines of:
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.
我创建了一个新项目,因为我找不到遮阳篷,为什么我的旧项目停止工作,我使用相同的代码,现在可以正常工作了
I created a new project because i couldn''t find an awnser why did my old project stopped working,i use same code and it works fine now
这篇关于如何使用MCI打开视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!