Solved

Killing a process in Windows 95

Posted on 1998-07-09
6
237 Views
Last Modified: 2013-11-19
I would like my MFC program to be able to kill any running process (I'm in Windows 95).  Must I get a list of all running processes?  If so, how?  Can I specify it by PID or program title or title bar title?
0
Comment
Question by:mcsilver
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:trestan
ID: 1318914
You can use kill statement to terminates a user's process based on the system process ID.
0
 
LVL 1

Author Comment

by:mcsilver
ID: 1318915
I looked up the KILL statement in the Dev Studio 5 help and it appears to only apply to SQL Server.  Will this work for any running (or sleeping) process running in the Windows 95 environment?  Also, how can I get a list of PIDs to know the PID number to send to the KILL statement?

Thanks.
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 100 total points
ID: 1318916
Given a window title who's process you wish to terminate, you can do this:
1. FindWindow() to get the widnow handle
2. GetWindowThreadProcessId to get the process ID
3.TerminateProcess to kill the process
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 1

Author Comment

by:mcsilver
ID: 1318917
Thank you.  This very sufficiently answers my question.  A couple things I'm still wondering, however: 1) is it possible to get a list of all running processes?  and 2) It appears that ExitProcess() is much safer and cleaner than TerminateProcess() and I should use ExitProcess().  But judging by its parameters, it doesn't appear possible to call ExitProcess() on any given process - just the process that calls ExitProcess().  Am I missing something here?

Thanks.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1318918
You can call ExitProcess for the calling process only. You can use EnumWindows to get the list of all windows, and then use GetWindowThreadProcessId to get each's process. Of course, you'll have to check for duplicate id's, cause one process may have more then 1 window
0
 
LVL 1

Author Comment

by:mcsilver
ID: 1318919
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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
Need to retreive data from .TFS file exported by DVR 8 217
repeatEnd java challenge 42 85
Looking for a specific application/software 2 114
changeXy challenge 13 87
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 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