How do I start a linked program when multiple files are selected?

I have installed a .jpg file associated with my own program. I want to add a context menu to .jpg files, so I set the HKCR.jpg \ shell \ open \ command entry to "myProg.exe% 1". After linking, the text "Open image with myprog" appears at the top of the context menu. This works correctly when I select one .jpg file, but when I select more than one file and click the top item of the context menu, nothing happened. How can I solve the problem?

Many thanks

+1


a source to share


2 answers


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 send its parameters to it (for example, using Windows messages) and then exit.



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

+1


a source


You may need double quotes around "% 1".

Read this article for more details on how it all works. http://msdn.microsoft.com/en-us/library/bb776883.aspx



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

0


a source







All Articles