Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dont know how to open video files,this is my code:

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


-for oppening video file:
C#
mciSendString("open \"" + fileName + "\" type mpegvideo alias mf style child parent " + this.VideoOutput, null, 0, IntPtr.Zero);

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
Posted
Updated 28-Jan-12 0:32am
v3
Comments
Amir Mahfoozi 28-Jan-12 6:54am    
Winform ? WPF ?

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
since PictureBox.ToString generates
System.Windows.Forms.PictureBox, SizeMode: Normal

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.
 
Share this answer
 
Comments
mmm3743 28-Jan-12 6:30am    
Sorry,I fixed the question,I already used Picturebox1.Handle.ToString(),but for some reason my old app doesn't work anymore
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
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900