如何使用程序的现有实例自定义右键? [英] How to customize right click with already existing instance of a program?

查看:125
本文介绍了如何使用程序的现有实例自定义右键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要自定义右键单击,以便可以使用防病毒程序扫描目录.我知道如何使用注册表项来执行此操作,但是...问题是我不想每次想扫描目录时都启动程序的新实例.我的防病毒软件需要加载一些特征库,因此第一次加载该程序大约需要15秒.我需要使用已经打开并正在运行的程序实例来扫描目录.我怎样才能做到这一点?

谢谢.

Hi,

I need to customize right click so that I can scan a directory with my anti-virus. I know how to do that using registry keys, ... but the problem is that I don''t want to start a new instance of my program every time I want to scan a directory. My anti-virus needs to load some signature databases so it will take around 15 seconds for the program to load at the first time.I need to use the instance of the program which I have already opened and is running for scanning the directory. How can I do that?

Thanks.

推荐答案

有很多方法可以让一个程序的一个实例运行并与之通信.
您可以将程序作为服务运行,并使用命名管道与服务进行通信.
或者,您可以使用RegisterWindowMessage将自定义消息发送到已运行的程序.
您甚至可以使用命名事件与正在运行的程序进行通信.

要自定义Windows Shell,建议的方法是使用Shell扩展.
这是有关编写Shell扩展的大量文章-《完整的傻瓜编写Shell扩展指南-索引 [ ^ ]
There are many ways to have only one instance of a program running and communicate with it.
You can run the program as a service and communicate with the service using named pipes.
Or you can send a custom message to an already running program using RegisterWindowMessage.
You can even use named events to communicate with the running program.

To customize the windows shell, the recommended way is to use shell extensions.
Here is a great set of articles on writing shell extensions - The Complete Idiot''s Guide to Writing Shell Extensions - Index[^]


这篇关于如何使用程序的现有实例自定义右键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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