当在特定文件夹中下载文档时,使用filesystemwatcher,我在一个线程中打开该word文档,这很好。我打开如下所示的文件
Private Sub watcher_Created(sender As Object, e As FileSystemEventArgs)
Try
DocWatcher.EnableRaisingEvents = False
ThreadPool.QueueUserWorkItem(
Sub(process)
OpenWord(e.FullPath)
End Sub
)
Catch ex As Exception
MsgBox(ex.Message)
Finally
DocWatcher.EnableRaisingEvents = True
End Try
end sub
sub OpenWord(byval Path as string)
// open document here
End sub
当文档关闭时,任何人都可以帮我找到如何捕获close事件,清除word对象(word.application)并清理该线程。
我是这个vb.net的新手并且花了几个晚上来解决这个问题。