作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 webBrowser 控件在 winforms 中打开 PDF 文档,它工作正常但是当关闭应用程序时我有时会收到一个错误:““0x2d864aa2”处的指令引用了“0x00000008”处的内存。内存不能是“读”。这个问题有解决方案吗?
问候。
最佳答案
信不信由你,昨天我一直在努力解决这个完全相同的问题,这是我找到的解决方案。将以下内容添加到 FormClosed
事件:
[DllImport("ole32.dll")]
private static extern void CoFreeUnusedLibraries();
private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
{
base.OnFormClosed(e);
webBrowser1.Visible = false;
while (webBrowser1.IsBusy)
{
Application.DoEvents();
}
webBrowser1.Dispose();
CoFreeUnusedLibraries();
}
实际上,似乎是 Adobe Acrobat 9.x 中的错误导致了此异常。
关于c# - webBrowser 控件中的 PDF 文档在关闭应用程序时导致 'The memory could not be "read"' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2787515/
我是一名优秀的程序员,十分优秀!