Can't print using printto verb with Photo Editor 3.0 from Office 97

S

Steven Rose

I'm using ShellExecute with the PrintTo verb to print any file that needs to
be printed, within an application. This routine works for common file types
such as Word documents, and I included it below since it's short.

The problem is with PNG files under Office 97 running on XP. Office 97
invokes Photo Editor 3.0 which displays the image and then does not respond.
The user must use End Task multiple times on both Photo Editor and our
application.

When the user prints the same file manually from the Windows Explorer
context menu, they are presented with a printing wizard with a Next and a
Finish. Obviously if this is happening when the application uses the
printto, that will be my problem.

Does anyone know if there is a way to make Photo Editor 3.0 print from an
application using the printto verb?


Our application works correctly under Office 2000, which invokes Photo
Editor 3.01. Advising the client to upgrade their version of Office is not
an option at this point.

Microsoft, would replacing their version of Photo Editor with the 3.01
version be a viable option and if so would the client need to migrate to a
later version of Office in order to legally run the later version of Photo
Editor?
They only use it because it's the default for this file type, and another
program would be just as good for them but more hassle for us.

Thanks for whatever help you can give.

Cheers
Steve

- - - - - Code snippet - - - - -

Public Shared Sub PrintFile(ByVal sFileToPrint As String, ByVal
sPrinterName As String)
Dim os As System.OperatingSystem = System.Environment.OSVersion
Dim psi As ProcessStartInfo = New ProcessStartInfo()
Dim p As Process = New Process()
Dim p2 As Process

Try

'Quote the fileName if 2k or above.
If (os.Platform = PlatformID.Win32NT And os.Version.Major >= 5) Then
'Win 2k up.
psi.FileName = """" & sFileToPrint & """"
Else 'All other OSes don't need/want the quotes."
psi.FileName = sFileToPrint
End If

'Quote Printer name
sPrinterName = """" & sPrinterName & """"

psi.Verb = "printto"
psi.Arguments = sPrinterName 'Set Printer
psi.UseShellExecute = True

'Start the process
p2 = p.Start(psi)
If Not (p2 Is Nothing) Then 'Wait for process to end
p2.WaitForExit()
End If

Catch wex As System.ComponentModel.Win32Exception
Throw wex
Catch ex As Exception
Throw ex
End Try

- - - - - End Code snippet - - - - -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top