Autor Beitrag
Melvyn
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Mi 20.08.08 13:10 
Hello Community :D
Vor ein paar Wochen habe ich begonnen mit C# zu programmieren und bin recht zufrieden damit. Zwecks Programmiererfahrung unter VB.NET habe ich mich auch schnell in C# eingelebt und bin voller Elan an einen AVI-Player :D
Google benutzt und siehe da: DirectX eignet sich dazu ^^
Nun ein Problem... DirectX spielt mir *.wmv ohne weiteres ab, bei *.avi kommt mir aber die untenstehende Fehlermeldung.
Falls es hilft habe ich noch den Codeabschnitt am Schluss eingefügt...

Danke schonmal für eure Hilfe ;)
Gruss Ich

Fehlermeldung:
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
Microsoft.DirectX.DirectXException wurde nicht behandelt.
  Message="Fehler in der Anwendung."
  Source="Microsoft.DirectX.AudioVideoPlayback"
  ErrorCode=-2147467262
  ErrorString="E_NOINTERFACE"
  StackTrace:
       bei Microsoft.DirectX.AudioVideoPlayback.Video.Open(String fileName, Boolean autoRun)
       bei Microsoft.DirectX.AudioVideoPlayback.Video..ctor(String fileName, Boolean autoRun)
       bei AVI_test.frmAVI.OpenVideo() in C:\Documents and Settings\psty\My Documents\C#\AVI_Test\AVI_Test\Form1.cs:Zeile 43.
       bei AVI_test.frmAVI.tsiOpen_Click(Object sender, EventArgs e) in C:\Documents and Settings\psty\My Documents\C#\AVI_Test\AVI_Test\Form1.cs:Zeile 27.
       bei System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       bei System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
       bei System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       bei System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       bei System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       bei System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       bei System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       bei System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
       bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       bei System.Windows.Forms.Control.WndProc(Message& m)
       bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       bei System.Windows.Forms.ToolStrip.WndProc(Message& m)
       bei System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
       bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       bei System.Windows.Forms.Application.Run(Form mainForm)
       bei AVI_test.Program.Main() in C:\Documents and Settings\psty\My Documents\C#\AVI_Test\AVI_Test\Program.cs:Zeile 18.
       bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       bei System.Threading.ThreadHelper.ThreadStart()
  InnerException:




Codeschnippsel
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
        void OpenVideo()
        {
            OpenFileDialog ofdOpen = new OpenFileDialog();
            ofdOpen.Filter = "Movie-Files|*.avi;*.wmv|Alle Dateien|*.*";
            ofdOpen.DefaultExt = "avi";
            if (ofdOpen.ShowDialog() == DialogResult.OK)
            {

                if (movie != null)
                    movie.Dispose();
                    
                try
                {
                    movie = new Video(ofdOpen.FileName, false);
                    movie.Owner = pnlMovie;
                    movie.Play();
                }
                catch(DirectXException e)
                {
                    MessageBox.Show(e.TargetSite + " throws exception!\n\n" + "Error: " + e.ErrorString + "\n\n" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }             
        }


Moderiert von user profile iconChristian S.: Highlight-Tags durch Code- bzw. C#-Tags ersetzt
@ Christian S.: Danke fürs editieren ;) Da beim Highlight steht "auch Code" dachte ich, dass man das auch für Code verwenden sollte... Sorry ^^