470,624 Members | 2,235 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,624 developers. It's quick & easy.

using system.diagnostic.process

I found the classes you wrote of but it doesn't work. i tested also this
code but it cretaes instances of worpad.exe that i only see

by task manager and i cannot terminate them. have you any ideas?

Dim pr As New System.Diagnostics.Process

pr.StartInfo.WindowStyle = Diagnostics.ProcessWindowStyle.Normal

pr.StartInfo.CreateNoWindow = False

pr.Start("C:\Programmi\Windows NT\Accessori\wordpad.exe")

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> ha scritto nel
messaggio news:br************@ID-208219.news.uni-berlin.de...
* "sandro72" <gf*****@pippo.com> scripsit:
hi, i need to simulate the right mouse click and choose an option.
i want to use (in .net) the option "print" that appear when i right-click on .doc file and be able to change the printer before and after the print.
can i launch word from command line forcing it to print a document?


\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.doc"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


Nov 20 '05 #1
3 5463
* "sandro72" <gf*****@pippo.com> scripsit:
I found the classes you wrote of but it doesn't work. i tested also this
code but it cretaes instances of worpad.exe that i only see

by task manager and i cannot terminate them. have you any ideas?


\\\
System.Diagnostics.Process.Start("C:\Programmi\Win dows NT\Accessori\wordpad.exe")
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
same problem. i also gave all rights to user aspnet for wordpad but nothing
changed.
in VB6.0 the following code works fine:

Dim myapp As Word.Application
Set myapp = New Word.Application
Dim mydoc As New Word.Document

Set mydoc = myapp.Documents.Open("C:\ss.doc")
mydoc.Activate
myapp.PrintOut

in vb.net it starts winword (i can see it in task manager) but no windows
appear and no printing process is started.
Dim myapp As Word.Application

myapp = New Word.Application

Dim mydoc As New Word.Document

mydoc = myapp.Documents.Open("C:\ss2.doc")

mydoc.Activate()

myapp.PrintOut()

can it be any .net confiuration?
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> ha scritto nel
messaggio news:br************@ID-208219.news.uni-berlin.de...
* "sandro72" <gf*****@pippo.com> scripsit:
I found the classes you wrote of but it doesn't work. i tested also this
code but it cretaes instances of worpad.exe that i only see

by task manager and i cannot terminate them. have you any ideas?
\\\
System.Diagnostics.Process.Start("C:\Programmi\Win dows

NT\Accessori\wordpad.exe") ///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
Hi Sandro,

You need to ask word to make it visible.

Dim moWordApp As Word.Application
Dim moWordDoc As Word.Document

Set WordApp = New Word.Application
WordApp.Visible = True
moWordDoc.SaveAs "SOMEDOCUMENT"
moWordDoc.PrintOut
moWordDoc.Close

Let me know if this helped.
"sandro72" <gf*****@pippo.com> wrote in message
news:br**********@newsread.albacom.net...
same problem. i also gave all rights to user aspnet for wordpad but nothing changed.
in VB6.0 the following code works fine:

Dim myapp As Word.Application
Set myapp = New Word.Application
Dim mydoc As New Word.Document

Set mydoc = myapp.Documents.Open("C:\ss.doc")
mydoc.Activate
myapp.PrintOut

in vb.net it starts winword (i can see it in task manager) but no windows
appear and no printing process is started.
Dim myapp As Word.Application

myapp = New Word.Application

Dim mydoc As New Word.Document

mydoc = myapp.Documents.Open("C:\ss2.doc")

mydoc.Activate()

myapp.PrintOut()

can it be any .net confiuration?
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> ha scritto nel
messaggio news:br************@ID-208219.news.uni-berlin.de...
* "sandro72" <gf*****@pippo.com> scripsit:
I found the classes you wrote of but it doesn't work. i tested also this code but it cretaes instances of worpad.exe that i only see

by task manager and i cannot terminate them. have you any ideas?


\\\
System.Diagnostics.Process.Start("C:\Programmi\Win dows

NT\Accessori\wordpad.exe")
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Stefan Turalski \(stic\) | last post: by
2 posts views Thread by adish11 | last post: by
1 post views Thread by FredC | last post: by
5 posts views Thread by Paul Bergson | last post: by
6 posts views Thread by bill | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.