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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

840 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