473,480 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

trying to invoke shell command on IE 6

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()

May 24 '06 #1
2 1676

Can you expose the print method via the IE COM object,
SHDocVw.dll,SHDocVw.dll?

http://www.c-sharpcorner.com/Code/20...IEInstance.asp

Glenn Venzke wrote:
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()

May 24 '06 #2
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

"John A. Bailo" wrote:

Can you expose the print method via the IE COM object,
SHDocVw.dll,SHDocVw.dll?

http://www.c-sharpcorner.com/Code/20...IEInstance.asp

Glenn Venzke wrote:
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()

May 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7028
by: Patrice FRITSCH | last post by:
I'm trying to run a batch file from an asp page using WScript.Shell object. Dim oWSH set oWSH= Server.CreateObject("WScript.Shell") call oWSH.Run("cmd.exe /c " & szCmd , 0, true) szCmd...
8
1333
by: Siemel Naran | last post by:
Hi. I'm writing a command shell that reads commands from standard input. At this point I have the command in a std::string. Now I want to execute this command in the shell. From the Borland...
7
7885
by: DB_2 | last post by:
Hello, I was trying to load a comma-separated text file to a DB2 table. I believe I have the syntax rigt for the LOAD command. My first question is, how do you actually run it? It is not a...
2
1469
by: Kenmlin | last post by:
Hi, I just need to do something simple like dir > dir.txt from Access. In C I could simply do system("dir > dir.txt");
8
35023
by: zhiwei wang | last post by:
I remember that there is a function that could invoke shell command such as "rm" "cp", directly in .c file. But I could not recall its name, and I googled with nothing meaningful. I vaguely...
3
8271
by: felecha | last post by:
I can get Windows Media Player to start, and play a wav file just fine using a command line "C:\Program Files\Windows Media Player\wmplayer.exe" c:\Temp\temp.wav But I want it to come up from...
5
3608
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
7
2690
by: Bin Chen | last post by:
Hi, I want to do following: get a user input regex, then pass this as a parameter to grep, and then get the result from grep. Any code snip to implement the similar function? I am a python...
2
6075
by: prakashpb | last post by:
Hello All, I am new to perl. I have to write some code in perl on windows. I have to invoke/run a shell file sample.sh from within perl file. When the perl while is executing, it should run to...
0
7037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7076
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6732
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4768
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2990
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
174
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.