Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Killing Child Process

Posted on 1997-08-13
5
261 Views
Last Modified: 2008-02-20
After spawning a child process with the Shell() command, I need to be able to kill the same process at a later stage. Is there a way of ding this in VB4 Pro?
0
Comment
Question by:Fot
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
y96andha earned 50 total points
ID: 1430766
Use OpenProcess to get a process handle from the return value from the Shell() command. Then use TerminateProcess with the process handle when you need to kill the process. This is assuming that you're using the 32-bit version of VB4.
0
 

Author Comment

by:Fot
ID: 1430767
Oops! Sorry, I forgot to mentin that I am using VB4 Pro (16-bit), not the 32-bit version. Any other ideas?

0
 
LVL 5

Expert Comment

by:y96andha
ID: 1430768
Will you be using Win95, Win3.1 or WinNT?
0
 

Author Comment

by:Fot
ID: 1430769
The application in question will be required to run on both Win3.1 and Win95 workstations in the near future, and possibly WinNT further down the line. I don't particularly wish to start messing around with Win32, and I can't possibly shut out our current Win3.1 users, as they make up approx. 60% of our user base.
0
 
LVL 5

Expert Comment

by:y96andha
ID: 1430770
In toolhelp.dll, there is a function called TerminateApp which will kill a process given its task handle.

Declare Sub TerminateApp Lib "toolhelp" (ByVal hTask As Integer, ByVal flags as Integer)

flags = 0 will popup a message box, flags = 1 will close the task quietly.

I know that the return value from the shell function is a PID in 32-bit, but  I am not sure what the return value from the shell funtion is in 16-bit?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Updates not working for MS Windows 7 12 180
Add a task in Outlook from access 11 42
Can we place a tooltip on the actual vb6 form 5 47
Sub or Function is not defined 6 43
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question