Jump to content

Recommended Posts

Posted

We have a tool in our company's Visual Studio 2008 (C#) application that generates a screenshot of our application that works great.

We have been calling the PC's default photo viewer to display these images, which is typically Windows Photo Viewer.

Everyone in our company likes the interface, but it is so realistic that we find our employees are trying to press buttons and controls on the image.

I created a simple photo viewing tool to display the screenshots, but now I have lost the ability to easily send images to the printer with the Windows Photo Viewer software.

Is there a way to call Windows Photo Viewer's "print" command when my form's Print button is clicked?

Most of our PCs are Windows XP, but we are slowly migrating to Windows 7 (Vista never made it).

FileInfo _screenShot;

private void Print_Click(object sender, EventArgs e) {
if ((_screenShot != null) && (_screenShot.Exists)) {
PrintWithSDK(_screenShot.FullName);
}
}

public static void PrintWithSDK(string fullName) {
// Help needed here
}


Posted

We have a tool in our company's Visual Studio 2008 (C#) application that generates a screenshot of our application that works great.

We have been calling the PC's default photo viewer to display these images, which is typically Windows Photo Viewer.

Everyone in our company likes the interface, but it is so realistic that we find our employees are trying to press buttons and controls on the image.

I created a simple photo viewing tool to display the screenshots, but now I have lost the ability to easily send images to the printer with the Windows Photo Viewer software.

Is there a way to call Windows Photo Viewer's "print" command when my form's Print button is clicked?

Most of our PCs are Windows XP, but we are slowly migrating to Windows 7 (Vista never made it).

FileInfo _screenShot;

private void Print_Click(object sender, EventArgs e) {
if ((_screenShot != null) && (_screenShot.Exists)) {
PrintWithSDK(_screenShot.FullName);
}
}

public static void PrintWithSDK(string fullName) {
// Help needed here
}

For a couple of years now, I've been using a FREE program called "Photo Filtre" to do screen shots, edit camera photos, and even add captions to some of my photos.

Putting a shortcut to it in my Quick Launch Toolbar makes it VERY convenient, for things like doing screen shots. I can even use Photo Filtre to access my scanner to scan an image and allow me to edit it.

One day I even scanned in a bunch of 50 year old color slides, with my Epson Scanner, which needed additional contrast and some cropping.

There's NO WAY I could possibly tell you all the features of Photo Filtre, so it's something you'll have to try out yourself. Please do! (Yes, I spelled it correctly.....it's from France, thus the spelling)

Good Luck,

Doc B)

Posted

Hi Doc,

Actually, I need to write some code so that the tool that is built into my application can send a print job to the printer.

What you are describing sounds great, but to get it to work would require installing it on every PC that my application is installed on. We have hundreds of PCs at our facility running my application.

I want to know how to programmatically call the Windows tool that is "built in" so that I do not have to do this.

Posted (edited)

Something like this?

I don't ...*think* so.

I've already created the image.

What I'm after is the Windows Photo Viewer Print Dialog box ...but I don't know if that's what it is really called.

I'm looking for something in Windows that already exists (like OpenFileDialog, SaveFileDialog, and PrintDialog), but I want the Print Dialog that Windows Photo Viewer uses (see screenShot.png attachment):

post-291490-127323921299_thumb.png

public static void PrintWithSDK(string fullName) {
// FYI: WindowsPhotoViewerPrintDialog does not really exist, or at least I've got it named incorrectly
using (WindowsPhotoViewerPrintDialog dlg = new WindowsPhotoViewerPrintDialog()) {
dlg.ImagePath = fullName;
dlg.ShowDialog();
}
}

Above is the type of code I am after.

Does anyone know if something like that exists?

Edited by jp2code
Posted

It doesn't, technically - the Windows Photo Viewer has wrapped what I linked in their own UI, and unless the WPV exports APIs to allow you to automate it's print functionality (and it doesn't), you'll have to do it yourself or do what I linked and do the printing controls yourself, from your app. I don't think that the Windows Photo Viewer app has any COM automation either, but you could check to be sure.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...