Solved

How do you tell an existing instance of Windows Photo Viewer to load and display a different image?

Posted on 2013-11-01
2
620 Views
Last Modified: 2013-11-02
Is there a way to tell an instance of Windows Photo Viewer that I have started via Process.Start, to load and display a different image?

Dim fileName As String = "C:\Users\John\Blah Blah\Picture.jpg"

Dim photoViewerProcess As Process = Process.Start("rundll32 ""%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll"", ImageView_Fullscreen " & fileName)

Is there some sort of message I could send to the photoViewerProcess to tell it to load a different image?

I don't want to leave a whole bunch of photo viewers open if I end up wanting to display lots of images.

A workaround is to close the existing process and open a new one but I was wondering if I could just tell the current instance to switch images.
0
Comment
Question by:ou81aswell
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 39618861
The PhotoViewer is a standard C/C++ application, its neither COM or .NET, so it has not been designed to be controlled programmatically.

The only way I see to control it would be to use the SendKeys class. Its Send method sends text to the system as if it had been typed on the keyboard. Thus, if you know the shortcuts and keystrokes needed to open a file, you can send them with SendKeys.Send.

SendKeys can save the situation in cases where you cannot control an application directly. But because you cannot use it to send data to a given application. Since it goes through the keyboard system, the keys end up on whatever window has the focus.
0
 

Author Comment

by:ou81aswell
ID: 39618906
Thanks. I looked at the app and couldn't figure out how to get it to open a different image. There doesn't appear to be a menu option to do that so I won't be able to use good old SendKeys so I'm keeping track of the instance myself and closing it before displaying a different image.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question