Solved

Killing Child Process

Posted on 1997-08-13
5
264 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
[X]
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
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

705 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