Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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.
Posted
Comments
Prasad_Kulkarni 11-Jan-12 0:44am    
My 5

1 solution

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[^]
 
Share this answer
 
Comments
lilyNaz 11-Jan-12 2:19am    
Thanks for your answer, I think in my case it is best to use RegisterWindowMessage. Do you know any good tutorial or guide which I can read on this one?
From what I got I have to write another application and define a particular message for both of them...
«_Superman_» 11-Jan-12 2:32am    
There are a few articles here on CP -
http://www.codeproject.com/KB/dialog/messagehandling2.aspx
http://www.codeproject.com/KB/tips/BijuBroadcast.aspx
http://www.codeproject.com/KB/vbscript/vb6ipc.aspx
lilyNaz 11-Jan-12 6:33am    
Thanks again. I tried using message passing techniques but since I am working in Embarcadero c++ builder, I can't use ON_REGISTERED_MESSAGES or even ON_COMMAND for the registered messages...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900