gpt4 book ai didi

c# - webBrowser 控件中的 PDF 文档在关闭应用程序时导致 'The memory could not be "read"' 错误

转载 作者:行者123 更新时间:2023-11-30 15:11:04 27 4
gpt4 key购买 nike

我正在使用 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();
}

实际上,似乎是 Adob​​e Acrobat 9.x 中的错误导致了此异常。

关于c# - webBrowser 控件中的 PDF 文档在关闭应用程序时导致 'The memory could not be "read"' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2787515/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com