杀死一个特定的Word文档 [英] kill a particular word document out of many

查看:56
本文介绍了杀死一个特定的Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在我的系统中,我打开了几个word文档.
我想使用vb.net/c#杀死特定的Word文档.

请任何人帮助.

目前,我正在使用下面的代码,这将杀死所有单词应用程序

Hi,
In my system I open several word document.
I want to kill a particular word document using vb.net/ c#.

Please anybody help.

currently I am using below code which is killing all word application

' Kill  word application
if  isWordRunning =true then
For Each process As Process In Process.GetProcessesByName("winword.exe")
    process.Kill
    process.WaitForExit
Next
end if
' Get any word application is runing or not
    Private Function isWordRunning() As Boolean
        Return (System.Diagnostics.Process.GetProcessesByName("winword").Length > 0)
    End Function

推荐答案

如果您能以某种方式掌握该特定应用程序的进程ID或会话ID,那么它应该很容易.
If you can somehow get hold of the process id or the session id of that particular application, then it should be easy.


是的,因为Abhinav建议您可以通过存储ProcessID和然后按该特定应用程序的ID终止进程.
我得到了一些链接,希望这些 Link1 [ ^ ]和 Link2- [存储ProcessID和通过PID杀死进程] [ ^ ]可能会为您提供帮助.
yeah as Abhinav suggest you it can be possible by store ProcessID and then kill process by ID of that particular application.
I got some link and Hope these Link1[^] and Link2-[Store ProcessID and Kill Process by PID][^] might help you.


这篇关于杀死一个特定的Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆