Question

In cxGrid i have a column which is "Image" type.(properties=Image,GraphicClassName=TJpegImage). To the PopUpMenuLayout - MenuItems I have added a CustomMenuItem called "Open With...". How can I implement this custom menu item so that it opens my underlying image with Paint (windows Paint)? Or at least trigger the "Open with.." windows dialog.

Was it helpful?

Solution

If you have your image stored in a database then you will first have to save it into image file on your computer.

Then you can then simply use ShellExecute for opening this image with default image viewing/editing program. ShellExecute works basically the same as if user would have double-clicked on your file. The problem is that usually doublec-licking on image file opens a preview of it so if you need to edit that image using of ShellExecute might not be the best way.

Now in order to be sure that the image is opened for editing rathen than just in preview you would have to read windows registry to get information about which program is used for viewing and editing of that specific image format and then use CreateProcess API cal instead.

You could also make sure that image is opened with specific program by starting that program using CreateProcess API call and passing image location as startup parameter (most image editing programs treat first parameter as file to open upon startup

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top