确定哪个进程正在使用 DirectShow 过滤器并杀死它?
有没有办法确定哪个进程正在使用特定的 DirectShow 过滤器?具体来说是视频捕获过滤器。
如果我们的应用程序在尝试使用 DirectShow 过滤器时抛出异常,因为它已在使用中,我们希望识别正在使用该过滤器的进程并将其终止。当然,这不是通用或分布式应用程序,而是安装在专用计算机上的应用程序,其唯一目的是运行我们的应用程序。
谢谢,
Is there a way to identify what process is using a particular DirectShow filter? Specifically a video capture filter.
If our application throws an exception trying to use a DirectShow filter because it's already in use, we would like to identify the process that is using the filter and kill it. Of course this is not a general purpose or distributed application but one installed on a dedicated computer whose sole purpose is to run our application.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
理想情况下,我认为应该尽一切努力避免终止进程......结果可能会发生许多不好的事情。也就是说,我的建议由 5 个部分组成:
由于您没有指定任何语言或编程框架,为了方便起见,我将假设 C#/.net。
1- DirectShow 过滤器只是 COM 对象,因此它们在系统中注册。你需要弄清楚你的过滤器的GUI,使用这个GUID,你可以找到存储这个对象信息的注册表项,然后你可以从那里检索dll在文件系统中的位置。 Microsoft.Win32.Registry 可用于访问注册表。
2- System.Diagnostics.Process.GetProcesses() 可用于枚举所有正在运行的进程。
3- System.Diagnostics.Process.Modules可用于枚举进程加载的所有模块(dll)。
其余步骤应该很简单。
Ideally, I think killing a process should be avoided by all means... many bad things can happen as result. That said, my proposal counts on 5 parts:
Since you did not specify any language or programming framework, I will assume C#/.net just for convenience.
1- DirectShow filters are just COM objects, so they are registered in the system as such. You need to figure out the GUI of your filter, using this GUID, you can locate the registry key where this object information is stored, then you can retrive the location of the dll in the file system from there. Microsoft.Win32.Registry can be used to access the registry.
2- System.Diagnostics.Process.GetProcesses() can be used to enumerate all running process.
3- System.Diagnostics.Process.Modules can be used to enumerate all modules (dlls) loadded by the process.
The rest of the steps should be trivial.