473,785 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Starting process using shell execute returns nothing

dim FileName as string = "Test.doc"
dim P as Process = Process.Start(F ileName)
'--P is NOTHING even though document opens!!!

dim Q as new process
Q.StartInfo.Fil eName = FileName
P = Q.start
'--P is nothing here, either

WHY????
--
--Zorpie
Oct 19 '06 #1
4 3778
Did you try this code?

Dim q As Process

q = Process.Start(" C:\windows\Note pad.exe")
q.WaitForExit()
Console.WriteLi ne("Exit Time:" & q.ExitTime)
Oct 19 '06 #2
That would work fine because you are launching an executable. By launching a
..doc file it uses ShellExecute and does not seem to return a process. This
is what I don't get.
--
--Zorpie
"ma*****@verizo n.net" wrote:
Did you try this code?

Dim q As Process

q = Process.Start(" C:\windows\Note pad.exe")
q.WaitForExit()
Console.WriteLi ne("Exit Time:" & q.ExitTime)
Oct 19 '06 #3
As far as I can tell, since vb2003. you can use the 'proccess.start ' method
to launch any program with it's dedicated exe.

For example

Dim q As New Process

Dim ofd As New OpenFileDialog

ofd.Filter = "Doc Files|*.doc"
If ofd.ShowDialog = Windows.Forms.D ialogResult.OK Then
q = Process.Start(o fd.FileName)

Console.WriteLi ne("Process Name:" & q.ProcessName)
q.WaitForExit()
End If

Console.WriteLi ne("Exit Time:" & q.ExitTime)

Console wrote:
Process Name:WINWORD
Exit Time:10/18/2006 10:11:14 PM
Oct 19 '06 #4
Yes, the program starts. That is not the problem. I'm trying to get
notified when the user closes down the launched window. To do that I need
the process to exist so it can raise the exited event, but the process
returned after the launch takes plase is NOTHING, so I can't catch the event.

Sorry, I guess I was not clear enough.
--
--Zorpie
"ma*****@verizo n.net" wrote:
As far as I can tell, since vb2003. you can use the 'proccess.start ' method
to launch any program with it's dedicated exe.

For example

Dim q As New Process

Dim ofd As New OpenFileDialog

ofd.Filter = "Doc Files|*.doc"
If ofd.ShowDialog = Windows.Forms.D ialogResult.OK Then
q = Process.Start(o fd.FileName)

Console.WriteLi ne("Process Name:" & q.ProcessName)
q.WaitForExit()
End If

Console.WriteLi ne("Exit Time:" & q.ExitTime)

Console wrote:
Process Name:WINWORD
Exit Time:10/18/2006 10:11:14 PM
Oct 19 '06 #5

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

Similar topics

0
1578
by: Trips | last post by:
Hello Folks I have been having headache solving this and now I need your help I have developed an windows application which access network resources under differnt authenticated identity and not the client who is running the application The application runs on client machine and it has to access a network folder by impersonationg a specific user and downloads the file on client computer Now when user clicks on download/copy button...
18
4893
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE) p.stdin.write("hostname\n") however, it doesn't seem to work. I think the cmd.exe is catching it.
1
3478
by: Alexander N. Spitzer | last post by:
I am trying to write a program that will fork a process, and execute the given task... the catch is that if it runs too long, I want to clean it up. this seemed pretty straight forward with a single executable being run from the fork. The problem I am having now is that if I call a shell scripts, then lets say calls "xterm &", after the timeout has occurred, I kill the shell script, but the xterm is still running... I cannot seem to kill...
6
6848
by: Dmitri Shvetsov | last post by:
Hi, Can I start an external process from the Web Service? I'm using a code, compiler keeps silence, compiles ok and starts the project. When I trace in Debugger it doesn't start an external process. That's strange for me. I understand that it should be a new shell, but why I can't start it? Is it need to have a Windows application to start an external process? I created a very long batch files and a complicated script to work with...
3
5292
by: dave | last post by:
Hi, Does anyone know how I could make an .exe launched server side from an aspx file run faster? When I use javascript client side it of couse is much faster. Here's my code This code does work but it's extremely slow. What am I missing? Process Updater = new Process();
0
2190
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a command button in the application. So the code goes something like this: psiBat = New ProcessStartInfo(arrRun.Item(0)(1)) psiBat.WindowStyle = ProcessWindowStyle.Hidden
8
6521
by: cypher543 | last post by:
This has been driving me insane for the last hour or so. I have search everywhere, and nothing works. I am trying to use the subprocess module to run a program and get its output line by line. But, it always waits for the process to terminate and then return the output all at once. Can someone please show me some code that actually works for this sort of thing? It doesn't even have to use the subprocess module. Don't worry if the code...
1
1826
by: dae3 | last post by:
Let's say I have two programs: 'foo' and 'bar'. 'foo' always returns an exit code of 10. 'bar' always exits normally (i.e. returns 0). If I do: `foo | bar` in my shell, the shell will return 10. If I do: exec('foo | bar', $ignoreMe, $returnCode) in PHP, $returnCode will contain 0. Is there a way to detect a pipe's first process' exit code in PHP ?
7
6237
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke this shell script using the Subprocess module. Here is my code: def resultFromRunning_(command):
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5380
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.