【发布时间】:2019-03-20 09:00:53
【问题描述】:
我想要做什么:我正在从数据库中编写一个临时 pdf 文件并调用该文件以在 acrobat 阅读器中打开它。是的,这些 pdf 文件是安全的,我自己制作的。
现在我的问题是在 acrobat reader 关闭后删除临时文件。这段代码有效,但我认为这并不是最好的做法。
Dim myp As New Process
myp.StartInfo.FileName = filename
myp.Start()
myp.WaitForInputIdle()
myp.WaitForExit()
Dim errorfree As Boolean = False
While errorfree = False
Try
Threading.Thread.Sleep(250)
File.Delete(filename)
errorfree = True
Catch ex As Exception
End Try
End While
myp.Dispose()
信息:对于 acrobat reader,这两行
myp.WaitForInputIdle()
myp.WaitForExit()
不工作。
【问题讨论】:
标签: vb.net