Kill A Subprocess Generated By Another Subprocess?

Sep 1, 2011

I'm building an IDE and, while everything is working pretty well, I'm running into a problem. When I launch the external compiler as a process, using the .net process class, I can run it, redirect standard output and error and input pipes, etc. BUT when the compiler, in its final stage launches the compiled application, I can't close the compiled appliation from the IDE.

The order goes like this:

Myapplication launches the compiler --> the compiler launches the compiled app --> The compiler dies BUT the compiled app remains open.

Now, how could I close (kill the main thread/process) of the compiled application? If I try to kill the compiler process I've started, it does but the application is still life.Is there any way to get a list of the subprocesses generated by a process, and kill them?

View 6 Replies


ADVERTISEMENT

VB 2005 App Failing To Start Pscp Subprocess

Jul 7, 2011

I've got a VB2005 application written by a previous coder. I had to move it to a new windows 7 box, since the xp box it was hosted on had catastrophic hard drive failure. It worked fine on the xp box, but it fails on the windows 7 box.

More specifically, I've tracked it back to a specific subsection. It uses the Process library to start pscp, the putty scp command line tool. It has a timer to wait 400 seconds for the process to close, otherwise it stops the process and reports an error.

Unfortunately, on windows 7 it doesn't seem to even start the process, because it does not wait the specified 400 seconds, nor does it report the other error it would give if pscp did start, but failed. Is there a compatibility issue with the process library, or is it some configuration issue?

Update:

Alright, after more testing I've determined that the subprocess is getting spawned, but the parent is not waiting for it to exit.

it seems the VB code myProcess.WaitForExit(40000) is not actually waiting until the process exits. Is this because it can't 'see' the process and believes it has exited?

View 1 Replies

.net - Kill Several Processes In VB?

Apr 11, 2012

I currently have the following up in VS 2010

Dim myProcess() As Process = System.Diagnostics.Process.GetProcessesByName("calc")
For Each myKill As Process In myProcess
myKill.Kill()

However I cannot seem to get it to kill more than one process. Example I've tried

("calc",mspaint")
("calc,mspaint")
("calc"),("mspaint")

View 1 Replies

How To Kill A Process

Oct 15, 2011

I am trying to kill a process by using the following code

Dim aprocess As System.Diagnostics.Process
aprocess = System.Diagnostics.Process.GetProcessesByName("E:\preview.mp3")

[code].....

View 5 Replies

How To Kill A Process From .NET?

Jan 16, 2011

I have built a web browser using vb.net and I want the user to use this only, that is I would like to restrict user form using any other browsers.So the question is, how to kill a process (IE) the moment user opens it. I am able to get all the processes and able to kill the current process. But the current process is always my app.

View 7 Replies

How To Kill A Process In .net

Feb 22, 2010

I've launched wampserver using vb.net when the application loads. My problem is, how do I kill the wamp server process when I exit the program.

View 1 Replies

How To Kill Myprocess

Feb 17, 2011

If I want to abort or end this operation, myprocess.kill() does not work I'm thinking that the Cmd box gets killed but tsmuxer remains alive to fight another day.

[Code]...

View 2 Replies

Kill A Process By Name?

Jun 22, 2010

This is what I have so far.[code]...

View 7 Replies

Way To Kill Process

Jun 2, 2012

On my exit button I have application.exit but this does not kill my application all teh time as sometimes I can see the process still running when I go into task manager, is there a way to kill the process when i close my application?

View 5 Replies

Kill Explorer.exe Process?

Jul 29, 2010

I want to kill explorer.exe process in vb.net

View 6 Replies

Way To Kill A System Process

May 18, 2009

I am looking for a way to kill a system process.my program is printing a word doc but i have noticed that one it has printed the process Winword.exe is still running in the task manager!does anyone know how once i have printed and closed word i can kill the process?

View 5 Replies

Any Way To Kill Driver (SYS File)?

Jun 25, 2009

Is there any way we can kill a driver (.sys file)?

View 10 Replies

Close Another Exe Without Process.Kill() ?

Mar 11, 2012

I've been doing some research on controlling another exe without Process.Kill() .

The reason why is that I want to have a main controller program that starts and terminates my other exes . I can't use Process.Kill() it just kills my exe without giving it a chance to save data or handle the form closing event . I want to separate my program to multiple exes to prevent a scenario which is if one of the exe hangs , all the other exe hangs .

When the termination event or signal is received , then the exe would do a rollback or handle the closing part to prevent data loss etc .

So far , I've only found some methods of doing that .

1) using TxT files to communicate between exes.
2) Inter-Process Communication (IPC) using name pipes .

View 14 Replies

Don't Let Console To Kill Process

May 28, 2009

I am developing a large, multi-windowed application. It creates a console using AllocConsole and uses it to dump various information useful for diagnosing and debugging situations with the hardware. The program drives sensitive scientific equipment, and CANNOT be allowed to quit abruptly in midstream. Unfortunately, clicking the close box on the console window does exactly that.

1. Suppress or disable the close box on the console window

2. Trap that event, or

3. Adjust something so that my process does not depend upon its console for its life?

View 2 Replies

How To Kill A Background Worker In .net

Mar 10, 2011

i m trying to kill a background worker in the do work event of the worker i was using

backgroundworker.CancleAsync()

but its shows an error saying tat CancellationPending does not allow

how can i kill a background worker after its work gets completed in its do work event

View 1 Replies

How To Kill An Instance Of An Application

Jul 15, 2011

I am having a text file in this path "C:Test est.txt" when this was openeed I need to close this.

When I am trying to use the below code all the instances of notepad are closing and I don't want that to be happened and I want to close only the ".txt" file:Here is my code:

Dim Process() As Process = System.Diagnostics.Process.GetProcessesByName("notepad")
For Each p As Process In Process
p.Kill()
Next

View 2 Replies

How To Kill And Restart A .exe File

Jan 22, 2009

Public Function RsReDir()
'function to restart dns redirector - working as of 12-11-08'
Dim plist As Process() = Process.GetProcesses()

[code].....

View 1 Replies

How To Kill Dupes From 2 Listboxes

Sep 30, 2009

I have 2 listboxesdoes anybody have a code to remove dupes from both listboxes if dupes exist?

View 5 Replies

How To Kill Thread Effectively

Jul 11, 2011

I am using normal thread and I am new to the thread. I want to know effective way of killing thread. I came to know that aborting thread is not good. Somewhere I read we can do this with having continue check on thread processing

View 7 Replies

Identify And Kill Process?

Dec 22, 2007

Let's say i create 3 different process like this:

For i = 1 To 3
im pr As New Process
pr.StartInfo.UseShellExecute = True

[code].....

View 8 Replies

Kill 3 Different Processes In One Shot?

Feb 5, 2012

I have a snippet how to kill multiple instances of one proccess

Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("notepad")
For Each p As Process In pProcess
p.Kill()
Next

If i want to kill multiple instances of "notepad","excel" and "word" how the code should look?

View 2 Replies

Kill A Running Process?

Jun 22, 2010

How to kill a process?[code]...

View 2 Replies

Kill A Specific Process?

Jun 22, 2010

I need to kill a specific process, i got ListBox1, and Button1 and Button2

Button1 Gets Process which is notepad, When Button1 is clicked in the ListBox1 it shows the Main titled of the windows, Example Notepad is running and his title is Untitled - Notepad in Listbox1 will show the title, And the Button2 Should kill the process of the selected item in the ListBox1, Like i Got 2 Notepad open, 1 with titled 1 and other with title 2, when i select in ListBox1 the one that says 1 and i click button2 it should kill the notepad process that have the titled 1 no all the notepads.

Button1 Code
Dim iGet() As Process = Process.GetProcessesByName("notepad")
Me.ListBox1.Items.Clear()

[Code]...

But it closes all notepad process, not even selecting the iem from ListBox1 and then Button i need it..

View 10 Replies

Kill A Thread Immediately?

Nov 12, 2010

Can anyone tell me how to kill a thread immediately.

I have tried MyThread.Abort, but it seems to do nothing. Someone told me it's because 'Abort' waits for the current operation to complete, but my thread will run for over 30 minutes before that happens.

View 4 Replies

Kill All Non Essential Processes?

Oct 14, 2010

I made an application that helps facilitate malware removal by running a bunch of different CLI scanners at once; among other things.

The app was made to run in normal and safe mode. The problem, is that since it has been made to run in normal mode, it essentially becomes useless if the malware has installed a rootkit that kills executables as they open or if they've messed with the exe file association in the registry.

So, to get my app to run, I thought to do 2 things.

First, change the file association of my app to either .com, scr, or .pif so that it can still launch but won't be affected by messed up reg keys or identified by the rootkit.

But, I still need to worry about that rootkit for the other apps.

So I thought to just kill all non essential processes.

What would be the best way to accomplish this?

I thought of two different ways:

I could either have a pre-compiled list of system processes that need to stay running or when looping through the processes, I can identify each by a specific property, like company name or something else.

View 3 Replies

Kill All Processes In A ListBox?

Jul 3, 2011

I'm trying to create a small productivity program to keep myself focused when programming; specifically, to close any processes that might distract me from doing my job.What is the easiest way to kill all processes listed in a listBox? I already know how to add the processes to my listBox with this code: [code]This adds the processes to the listBox very neatly and all, exactly how I want it. I have a timer that gets enabled with the press of a button that should close all processes in the listBox.

View 1 Replies

Kill And Restart An .exe File?

Jan 21, 2009

Public Function RsReDir() 'function to restart dns redirector - working as of 12-11-08'
Dim plist As Process() = Process.GetProcesses() 'Get and parse list of processes to plist'

For Each p As Process In plist 'parse each entry in plist as p process'

Try
If p.MainModule.ModuleName.ToLower() = "dnsredir.exe" Then p.Kill() 'If module name of process matches "dnsredir.exe" then kill p'
Catch

[code]....

i would like to kill and restart dnsredir.exe file but the code doesnt' seem to work?

View 1 Replies

Kill Explorer Without It Respawning?

Mar 11, 2010

So there only only two threads on the forum regarding killing explorer.exe, and neither one answers the question.Does anyone know how to kill explorer.exe (yes the Windows shell) and keep it from re-spawning? It is obviously possible, since taskkill does it. And for the moment I am using taskkill to accomplish this. But it sure would be nice to have a coded solution.

And yes I know what will be disabled when I kill explorer.exe, and yes this is exactly what we (the company at which I am employed) want to happen so please don't just tell me this is a BAD IDEA, like all the other forums on the internet have done to the people who have asked this.I have tried using the approach of looping through the array returned from Process.GetProcessesByName("explorer"), then killing each one of those returned processes. I have tried this in C++ with the native API... just in case there was some difference in the way the .NET libraries called things... In both cases explorer exits for a few seconds, then comes right back. The behaviour I would like to duplicate is that of "taskkill /f /im explorer.exe"

View 2 Replies

Kill Older Process With Same Name?

May 27, 2009

I'm using the following code to kill a program: Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("myprogram.exe")
For Each p As Process In pProcess p.Kill() Next

At one point it's running twice and the above code kills em all including the one currently running, resulting in an access error. Is there any way to say, kill the older myprogram.exe only. Compare both of them and see which one was executed first and terminate this one, keeping the later one running.

View 9 Replies

Kill Process That Is Using A File

Dec 15, 2009

I am making an updater that downloads some files from a webservice and copies them to a directory, overwriting old files.

It works ok, but what if a user for whatever reason has opened a file. It will throw an error, because the file is in use.

Is there a way to determine which process is using the file? Then I will be able to kill it.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved