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
646 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

729 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