Resolved process.start more image

Andy75

Member
Joined
May 29, 2020
Messages
18
Programming Experience
1-3
Hi all,
I have a string variable (path) that i get from an openFileDialog (Windows 10).
I would like to pass this path to Process.Start to start browsing the images of a folder.
I would like to show "next" and "previous" buttons too, in this way the user can moves with the mouse arrows.
How is this possible?
I have tried with
"ProcessStartInfo startInfo = new ProcessStartInfo (fileImage)",
but the button next and previuos are not there.
Tips?

thanks
 
The code you provided will open the MS Photos app (uwp) on W10, which is the app we're talking about in this thread.
 
Unfortunately that is not going to work. When you call Process.Start() giving it just a filename the default image viewer is launched by Windows and you don't have any control over that viewer that is launched. That viewer may not be the Win10 Photo Viewer. It may be Adobe. It may ACDSee. It may be plain old MSPaint.exe.

To get what you want where you have control, you'll need to create a form with the next/previous buttons and a picture box. Just load the "current" image into the picture box, and act appropriately when the next and previous buttons are pressed.
And here in lies the underlying functionality issue. As pointed out by my evil twin. It really does depend on what previewer is installed, and this will determine the underlying functionality of why it does not work for you and why it works for me. Do follow. This is still a valid answer, providing that the OP has the installed W7 DLL for the Windows Photo Previewer :
You can do this :
C#:
            const string Location_ToOpen = @"C:\Users\user\Downloads\Imported Pics\102ND500\Canapy Shots\Me In Canopy\Copyright\SCP_3546.jpg";
            ProcessStartInfo Process_Info = new ProcessStartInfo(Location_ToOpen, @"%SystemRoot%\System32\rundll32.exe % ProgramFiles %\Windows Photo Viewer\PhotoViewer.dll, ImageView_Fullscreen %1")
            {
                UseShellExecute = true,
                WorkingDirectory = Path.GetDirectoryName(Location_ToOpen),
                FileName = Location_ToOpen,
                Verb = "OPEN"
            };
            Process.Start(Process_Info);
Tested and working. Hope it helps.
Should our OP not have or want to install or use the W7 DLL. Then they will need to pass in supported arguments for the UWP version which you are all using. That includes targeting the UWP file to launch too.
 
I should point out that I wasn't targeting the UWP version, and I was targeting the older DLL from W7. See screenshot :
WhatsApp Image 2020-05-31 at 01.54.58.jpeg
 
There's even a uri scheme for it, but that doesn't seem to work outside UWP: Launch the default app for a URI - UWP applications
Now that I know you are all using the photos app from the Microsoft store, and not the old one from W7. UWP type apps are all operated on a sandbox and for that reason there are security policies which prevent us from executing other processes from inside their environment. So maybe there are also security policies which are preventing us from passing parameters to the photos app?

Regarding why your link doesn't work @JohnH; It may be a bug, one which may need patching. In which case, good luck to our OP waiting for that to happen. @Andy75 - It appears you have two options or so it seems.
  1. Bundle the windows 7 image previewer with your software
  2. Or do as @Skydiver suggested and roll with creating your own previewer.
 
Back
Top Bottom