trying to invoke shell command on IE 6

G

Guest

I'm trying to print an Adobe forms file (.fdf) using
system.diagnostics.process in a windows service. The problem is, IE is the
program that launches that file type & Verb = "Print" doesn't work in IE. IE
launches OK but crashes when the verb is invoked. Does anybody know how to do
a shell print command in IE 6? When I specifically states to open the file
using Acrobat, it opens in IE anyway. Code follows:

Dim objProcess As System.Diagnostics.Process
objProcess = New System.Diagnostics.Process
objProcess.StartInfo.FileName = "C:\ClaimReportPdf.fdf"
objProcess.StartInfo.Verb = "Print"
objProcess.StartInfo.CreateNoWindow = True
objProcess.Start()
 
G

Guest

Well, it's a step in the right direction. However, after implementing the
code in my windows service, I'm able to compile it & install it. But wher I
try to start it up, I get:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in
etasks.exe

Additional information: File or assembly name Interop.SHDocVw, or one of its
dependencies, was not found.

I placed a copy of "Interop.SHDocVw.dll" in C:\Bin. The executable resides
on C:\.
and made the following declaration:
Imports SHDocVw


code follows:

Private ie As SHDocVw.InternetExplorer = New SHDocVw.InternetExplorer
Private WithEvents objClockMonitor As Timers.Timer = New Timers.Timer

Private Sub objClockMonitor_Elapsed(ByVal Sender As Object, ByVal E As
Timers.ElapsedEventArgs) Handles objClockMonitor.Elapsed


Try
ie..Visible = False
ie.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER)
Catch ex As Exception
EventLog.WriteEntry(ex.ToString())
End Try
End Sub
 

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