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

Home Posts Topics Members FAQ

Stopping a program run from another

You have taught me how to start another program using
System.Diagnost ics.Process.Sta rt and suggested a good tip site and
Google search for future reference. My problem now is how to stop
that program I started. Even if I close my main program this program
remains listed in the Task Manager. I promise you I searched but
using words like end, stop, close found me lots of information but not
my specific need. Appreciate if you would help again

Ed
Jul 6 '07 #1
6 1454
On Jul 6, 7:55 am, "Ed Bitzer" <edbit...@yahoo .comwrote:
You have taught me how to start another program using
System.Diagnost ics.Process.Sta rt and suggested a good tip site and
Google search for future reference. My problem now is how to stop
that program I started. Even if I close my main program this program
remains listed in the Task Manager. I promise you I searched but
using words like end, stop, close found me lots of information but not
my specific need. Appreciate if you would help again

Ed
Have you looked at the docs for the Process class? You might try
Process.CloseMa inWindow or Process.Close.

Good luck

Chris

Jul 6 '07 #2
Something like this you are looking for ?

Private Sub KillExcel()

Dim myProcesses As Process
Dim myProcess As Process

myProcesses = Process.GetProc essesByName("EX CEL.EXE")
For Each myProcess In myProcesses
myProcess.Kill( )
Next

myProcesses = Nothing
myProcess = Nothing

End Sub

Miro
"Ed Bitzer" <ed******@yahoo .comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
You have taught me how to start another program using
System.Diagnost ics.Process.Sta rt and suggested a good tip site and Google
search for future reference. My problem now is how to stop that program I
started. Even if I close my main program this program remains listed in
the Task Manager. I promise you I searched but using words like end,
stop, close found me lots of information but not my specific need.
Appreciate if you would help again

Ed

Jul 6 '07 #3
On Jul 6, 9:17 am, Chris Dunaway <dunaw...@gmail .comwrote:
On Jul 6, 7:55 am, "Ed Bitzer" <edbit...@yahoo .comwrote:
You have taught me how to start another program using
System.Diagnost ics.Process.Sta rt and suggested a good tip site and
Google search for future reference. My problem now is how to stop
that program I started. Even if I close my main program this program
remains listed in the Task Manager. I promise you I searched but
using words like end, stop, close found me lots of information but not
my specific need. Appreciate if you would help again
Ed

Have you looked at the docs for the Process class? You might try
Process.CloseMa inWindow or Process.Close.

Good luck

Chris
What Chris means:

Dim pi As New ProcessStartInf o("MyDialer.exe ", "123 456 1234")
Dim p As Process = Process.Start(p i)
'// I also find a System.Threadin g.Thread.Sleep( ...) is sometimes
'// needed to allow the app to receive the close messages
p.CloseMainWind ow
p.Close

Thanks,

Seth Rowe

Jul 6 '07 #4
You probably would do the suggestions above within the main form closing
handler.

"Ed Bitzer" wrote:
You have taught me how to start another program using
System.Diagnost ics.Process.Sta rt and suggested a good tip site and
Google search for future reference. My problem now is how to stop
that program I started. Even if I close my main program this program
remains listed in the Task Manager. I promise you I searched but
using words like end, stop, close found me lots of information but not
my specific need. Appreciate if you would help again

Ed
Jul 6 '07 #5

"Ed Bitzer" <ed******@yahoo .comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
You have taught me how to start another program using
System.Diagnost ics.Process.Sta rt and suggested a good tip site and
Google search for future reference. My problem now is how to stop
that program I started. Even if I close my main program this
program remains listed in the Task Manager. I promise you I
searched but using words like end, stop, close found me lots of
information but not my specific need. Appreciate if you would help
again

Ed
Here is the code I finally settled upon inserted in the Form.Closed
sub - I will try the other ideas suggested to gain some better
understanding.
For Each oProcess2 In System.Diagnost ics.Process.Get Processes()
If oProcess2.Proce ssName.ToString = "phonepro" Then
oProcess2.Kill( )
MessageBox.Show ("Process started from code is now
killed")
Exit For
End If
Next
Application.Exi t() '

Ed


Jul 7 '07 #6
On Fri, 6 Jul 2007 08:55:24 -0400, "Ed Bitzer" <ed******@yahoo .com>
wrote:
>You have taught me how to start another program using
System.Diagnos tics.Process.St art and suggested a good tip site and
Google search for future reference. My problem now is how to stop
that program I started. Even if I close my main program this program
remains listed in the Task Manager. I promise you I searched but
using words like end, stop, close found me lots of information but not
my specific need. Appreciate if you would help again

Ed
Perhaps you should first figure out why the called program does not
close cleanly ... is it supposed to terminate itself when it has
completed its operation?

--
http://bytes.thinkersroom.com
Jul 7 '07 #7

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

Similar topics

1
7280
by: BKM | last post by:
I'm using a VB6 WebBrowser control to get info from various web pages and, occasionally, my program stops when it finds a script error on the page. It won't resume until I click 'Yes' or 'No' on the script error message box. However, if I open an IE6 browser outside the program and manually go to the same page I don't get the Script Error message box. I do get a yellow exclamation mark symbol with the message "Done, but with errors on the...
3
14622
by: Tobias Pfeiffer | last post by:
Hi! I am writing a network game where the server runs in a console window. The person who has opened the server shall be able to stop the process of accepting new clients. By now, I am handling that like this: while 1: try: bla = socket.accept() except KeyboardInterrupt:
7
1795
by: python | last post by:
I have a script that downloads some webpages.The problem is that, sometimes, after I download few pages the script hangs( stops). (But sometimes it finishes in an excellent way ( to the end) and download all the pages I want to) I think the script stops if the internet connection to the server (from where I download the pages) is rather poor. Is there a solution how to prevent the script from hanging before all pages are downloaded? ...
3
3385
by: VB Programmer | last post by:
Is aspnet_wp a service that can be stopped/restarted? Or, do I have to kill it through Task Mgr? If so, how do I restart it? Thanks.
4
2043
by: bjm | last post by:
I am writing a program that will automate a series of application installations. I want to give the user the option of stopping the program's execution in between installations (for example, give the user the chance to stop the program after the second installation before it continues on to the third installation). However, I want the user to be able to start the installations and walk away as well, so I can't ask the user if he wants to...
4
6368
by: Jeff | last post by:
Hi, I'd like to write Javascript that stops animated gifs from animating. On Firefox, at least, window.stop(); does the trick, although it stops everything on the page and is kind of unpredictable. If I connect it to the onload event, sometimes only half the page will be displayed. Does the onload even fire before rendering? Does anyone know a reasonable way to accomplish my original goal of
2
1523
daniel aristidou
by: daniel aristidou | last post by:
Hi i wrote code to print records off a datagrid.the code works on all but one of my data grids. The problem is that loop continues without stopping, Causing the program to crash. The only diff between all of the grids is the query and the widows form it is on. I basicly just copied the form changing the SQL for the datasource. any way so here is the code i typed: Private Sub Print_Click() Dim msg As Variant Dim spaceaftercolumn1 As Variant...
4
5720
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a main thread an another worker thread. The main Thread creates another thread and waits for the threads signal to continue the main thread. Everything works inside a ModalDialog and everyting is secured by Invoke/BeginInvoke, and synchronisation primitves like WaitHandles, Evetns, Semaphores, etc... All works good and with no race conditions or locks. I have a System.Windows.Forms.Timer in the main
2
3371
by: Steve | last post by:
Hi All, I've been trying to come up with a good way to run a certain process at a timed interval (say every 5 mins) using the SLEEP command and a semaphore flag. The basic thread loop was always sitting in the sleep command and not able to be interrupted. When the time came to set the semaphore flag to false (stopping the thread), my program would have to wait up to the entire sleep time to break out of the loop. I have finally found...
0
9645
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
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
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
8972
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...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.