我使用来自Adobe Reader 9安装的axAcroPDFLib控件在我的C#窗体应用程序中显示和打印用户PDF文档.一切正常,直到申请结束......
它会引发以下错误:
"0x0700609c"处的指令引用"0x00000014"处的存储器.无法读取内存
我的FormClosing方法很简单,我认为是错误的,但我不知道如何以正确的方式做到这一点:
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
if (axAcroPDF1 != null)
{
axAcroPDF1.Dispose();
}
}
Run Code Online (Sandbox Code Playgroud)
提前感谢任何想法
hec*_*cvd 11
我只想弄清楚如何正确关闭应用程序:
[System.Runtime.InteropServices.DllImport("ole32.dll")]
static extern void CoFreeUnusedLibraries();
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
if (axAcroPDF1 != null)
{
axAcroPDF1.Dispose();
System.Windows.Forms.Application.DoEvents();
CoFreeUnusedLibraries();
}
}
Run Code Online (Sandbox Code Playgroud)
有了它,不会抛出任何错误:D