Tutorial :How to start the associated program when selecting more than one files?



Question:

I have set .jpg file associated to my own program. I want to add the context menu to .jpg files, so I set the entry of HKCR.jpg\shell\open\command to "myProg.exe %1". After associating, there will be an item on the top of the context menu saying "Open image with myprog". This works right when I select a single .jpg file, but when I selected more than one file and click the top item of the context menu, nothing happended. How can I solve the problem?

Thank you very much


Solution:1

Each selected file will be sent to a new instance of your application. Your application should check if a previous version exists, or not. If a previous instance exists, it should sent its parameters to it (e.g. using Windows Messages) and then terminate.

Another approach is to use DDE (Dynamic Data Exchange), an old method used by Shell to send all files to one instance of your program.


Solution:2

You might need double quotes around the "%1".

Read this article for much more detailed information about how all this works. http://msdn.microsoft.com/en-us/library/bb776883.aspx

Also, this blog entry talks about what you need to do specifically for multi-select command execution: http://blogs.msdn.com/pix/archive/2006/06/30/652889.aspx


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »