请问这个问题是不是由于C#调用DLL引出的? 运行库遇到了错误。此错误的地址为 0x79e85bb3,在线程 0x550 上。错误代码为 0xc0000005。此错误可能是 CLR 中的 bug,或者是用户代码的不安全部分或不可验证部分中的 bug。此 bug 的常见来源包括用户对 COM-interop 或 PInvoke 的封送处理错误,这些错误可能会损坏堆栈。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void button1_Click(object sender, EventArgs e) { string name = ""; IWMMetadataEditor editor = null; IWMHeaderInfo3 headInfo = null; try { if (DialogResult.OK == openFileDialog1.ShowDialog()) { name = openFileDialog1.FileName; uint hr = WMFSDKFunctions.WMCreateEditor(out editor); uint hhr = editor.Open(name); headInfo = editor as IWMHeaderInfo3; ushort cntMarkers = 0; headInfo.GetMarkerCount(out cntMarkers); headInfo.GetScriptCount(out cntMarkers); //headInfo.AddMarker("course.Name", 10000000); //headInfo.AddScript("URL", "course.Name", 10000000); for (ushort i = 0; i < cntMarkers; i++) { string n = ""; ushort reqlen = 0; ulong time=0; string type = ""; string command = ""; ushort comLen = 0; uint h = headInfo.GetMarker(i, null, ref reqlen, out time); h = headInfo.GetMarker(i, n, ref reqlen, out time); listView1.Items.Add(n); //这里运行一次之后就会出现上述错误 //* headInfo.GetScript(i, null, ref reqlen, null, ref comLen, out time); headInfo.GetScript(i, type, ref reqlen, command, ref comLen, out time); MessageBox.Show(type); MessageBox.Show(command); //*/ } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //if (editor != null) { //editor.Flush(); //editor.Close(); } } } 你的问题主要就是平台调用过程中的数据封送问题。楼上有人已经给出了正确的答案。但是如果只获得答案,不知道原理,以后遇到了此类问题还是不知道如何下手。如果你想系统学习如何进行数据封送,我推荐你阅读刚刚出版的新书:《精通.NET互操作P/Invoke,C++Interop和COM Interop》,这本书的第2章“数据封送”详细介绍了平台调用中的数据封送过程,非常详细,我就是读完后才搞清楚平台调用中的封送处理。 该书的官方网站: www.interop123.com 豆瓣网信息: http://www.douban.com/subject/3671497/ 求ajax高手帮忙看下,不知道哪儿错了。有数据传递,但是总是出的是没有数据?? C#中如何调用C++代码的导出类 Winfrom水晶报表问题 DataGridView怎么修改指定单元格的内容? 服务中如何定时执行某段代码,高分求救(100分),参与有奖! C#中,有没有简单判定键盘输入与给定字符的比较?帮帮忙 VS2005的MSDN为什么这么慢????? 三个小问题,请教一下 异步通讯 c#初学者的一个问题,刚开始学了,兄弟们多多帮忙! 主窗体和子窗体问题 远程执行SQL脚本的问题
{
string name = "";
IWMMetadataEditor editor = null;
IWMHeaderInfo3 headInfo = null;
try
{ if (DialogResult.OK == openFileDialog1.ShowDialog())
{
name = openFileDialog1.FileName;
uint hr = WMFSDKFunctions.WMCreateEditor(out editor);
uint hhr = editor.Open(name);
headInfo = editor as IWMHeaderInfo3;
ushort cntMarkers = 0;
headInfo.GetMarkerCount(out cntMarkers);
headInfo.GetScriptCount(out cntMarkers);
//headInfo.AddMarker("course.Name", 10000000);
//headInfo.AddScript("URL", "course.Name", 10000000);
for (ushort i = 0; i < cntMarkers; i++)
{
string n = "";
ushort reqlen = 0;
ulong time=0;
string type = "";
string command = "";
ushort comLen = 0;
uint h = headInfo.GetMarker(i, null, ref reqlen, out time);
h = headInfo.GetMarker(i, n, ref reqlen, out time);
listView1.Items.Add(n);
//这里运行一次之后就会出现上述错误 //*
headInfo.GetScript(i, null, ref reqlen, null, ref comLen, out time);
headInfo.GetScript(i, type, ref reqlen, command, ref comLen, out time);
MessageBox.Show(type);
MessageBox.Show(command);
//*/
}
}
}
catch (Exception ex)
{ MessageBox.Show(ex.Message);
}
finally
{
//if (editor != null)
{
//editor.Flush();
//editor.Close();
}
}
}
该书的官方网站:
www.interop123.com 豆瓣网信息:
http://www.douban.com/subject/3671497/