0

I'm currently creating an application that will hold multiple images, I've decided that on an image I would like a context menu to appear when right clicking and have an option to send to an image editing application such as Photoshop, Gimp, Paint etc...

I know how to create a context menu, however I am unsure on the code to use in order to send the image to the application itself.

Jsam1978
  • 21
  • 1
  • 3
  • 2
    Most applications take a filename as the first argument. You could just trigger a shell command like `paint.exe "X:\somePath\myImage.bmp"` – LInsoDeTeh Jul 08 '15 at 11:05
  • If my answer is the accepted answer for the question then you should accept it by clicking the hollow check mark next to the answer, so that it becomes green. If you found a different solution then you should describe it here and accept it. – Dialecticus Oct 03 '15 at 09:42

1 Answers1

0

If you want to open the file in the default application then that was already answered. If you want to do the same the Explorer is doing on "Edit" context menu item, then add these two lines in "Original, complicated answer" from the link above:

if (psi.Verbs.Contains("Edit", StringComparer.OrdinalIgnoreCase))
    psi.Verb = "edit";

You should check the existence of the verb you want in psi.Verbs as per the MSDN. If there's no "edit" verb then the code calls default app.. by default.

If you want to give the user a list of all image editing apps that the user have installed then you would have to have a hardcoded database of such apps together with their installation GUIDs, check if they are installed, find out where they are installed (maybe not in the default place), and make a list of them, calling each with your file as a command line argument. It's too complicated to give code for that.

Community
  • 1
  • 1
Dialecticus
  • 16,400
  • 7
  • 43
  • 103