Hello,
I am trying to play .avi files on my Visual C# form in Visual Studio 2010, but I am getting a strange problem. I've download and installed the SDK though when I go to the Preferences list in my project, the DirectX items aren't listed. I have followed this article:
http://www.c-sharpcorner.com/uploadfile/mgold/playingvideo11242005002218am/playingvideo.aspx
I'm not sure whether there is a different SDK for the new Visual Studio, I haven't been successful in finding a resolution for this problem
Loading
Sam HobbsPosted Mar 18, 2011, 6:13 AM
FroglegPosted Mar 18, 2011, 5:22 AM
Sam HobbsPosted Mar 18, 2011, 4:18 AM
FroglegPosted Mar 18, 2011, 3:53 AM
Sam HobbsPosted Mar 18, 2011, 12:04 AM
System.BadImageFormatException was unhandled
Message= is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
Source=AudioVideoPlayback
StackTrace:
at AudioVideoPlayback.Form1.bttnPlay_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at AudioVideoPlayback.Program.Main() in C:\Users\Sam\Documents\Visual Studio 2010\Projects\C-SharpCorner\AudioVideoPlayback\AudioVideoPlayback\Program.cs:line 18
InnerException:
Sam HobbsPosted Mar 17, 2011, 11:34 PM
FroglegPosted Mar 17, 2011, 3:20 PM
Make sure to add reference to Microsoft.DirectX.AudioVideoPlayback in - add reference net tab
Note you will get an error if run in debug mode, so run the exe in the bin\debug folder
Edit Sorry this will not work in C#2010
You can how ever embed windows media player on your form
1: On the toolbox rightclick and select choose items
2:In com components check Windows Media Player box
3: Drag media player on your form
4: To load file
axWindowsMediaPlayer1.URL=(video file);