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
600 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now