+ -
当前位置:首页 → 问答吧 → c#调用暴风影音2组件

c#调用暴风影音2组件

时间:2011-10-24

来源:互联网

代码如下:[code=C#][/code]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices; 
namespace 多媒体播放2
{
  public partial class Form1 : Form
  {
  private System.Windows.Forms.OpenFileDialog openMediaFileDialog = new OpenFileDialog();
  private AxMPSLib.AxStormPlayer player;
  public Form1()
  {
  InitializeComponent();
  }

  private void openToolStripMenuItem_Click(object sender, EventArgs e)
  {
   
  openMediaFileDialog.ShowDialog();
  player.URL = openMediaFileDialog.FileName;
   

  }

  private void exitToolStripMenuItem_Click(object sender, EventArgs e)
  {
  Application.Exit();
  }  
  }
}
怎么调试的时候总是在这个地方(player.URL = openMediaFileDialog.FileName)提示:未处理 System.Runtime.InteropServices.COMException
Message="对 COM 组件的调用返回了错误 HRESULT E_FAIL。"
Source="Interop.MPSLib"
ErrorCode=-2147467259
  StackTrace:
  在 MPSLib.IKureePlayer.set_URL(String newVal)
  在 AxMPSLib.AxStormPlayer.set_URL(String value)
  在 多媒体播放2.Form1.openToolStripMenuItem_Click(Object sender, EventArgs e) 位置 C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\多媒体播放2\多媒体播放2\Form1.cs:行号 24
  在 System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
  在 System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
  在 System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
  在 System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
  在 System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
  在 System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
  在 System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
  在 System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
  在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  在 System.Windows.Forms.Control.WndProc(Message& m)
  在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
  在 System.Windows.Forms.ToolStrip.WndProc(Message& m)
  在 System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
  在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
  在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
  在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
  在 System.Windows.Forms.Application.Run(Form mainForm)
  在 多媒体播放2.Program.Main() 位置 C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\多媒体播放2\多媒体播放2\Program.cs:行号 17
  在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
  在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
  在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
  在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
  在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
  在 System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

作者: fjf208720   发布时间: 2011-10-24

我也遇到这问题了,解决了能否发个邮件[email protected]

作者: lxh_worldpeace   发布时间: 2011-12-25