AddContextMenuItem multiple files
-
How I do to select multiple files in Windows Explorer, and run one command like "Execute", and all files need be passed as multiple parameters to one application. I have tried the function AddContextMenuItem in this article: http://www.codeproject.com/tools/cpzipstripper.asp but works only to one instance, if I try multiselect files and click "Execute", opens multiple instances of my application, instead of one instance with multiples args... Thank you for all
-
How I do to select multiple files in Windows Explorer, and run one command like "Execute", and all files need be passed as multiple parameters to one application. I have tried the function AddContextMenuItem in this article: http://www.codeproject.com/tools/cpzipstripper.asp but works only to one instance, if I try multiselect files and click "Execute", opens multiple instances of my application, instead of one instance with multiples args... Thank you for all
There are two approaches that come to mind. First is write a dynamic shell context menu handler that stores all the files selected in the IShellExtInit::Initialize method. This is pretty easy in C++ using one of the wizards you can find here on the Code Project. In C# it's a bit more hairy though. The easier approach in C# would be to modify your app so that it only runs a single instance and any additional instances just pass the command line to the first instance. I'm pretty sure there are examples here of C# single instance apps. Then it's just a matter of passing the command line info. Search on single instance apps in C# here and you should get some working code so you can see various methods to pass info from one instance to another.