Solved

Killing a process in Windows 95

Posted on 1998-07-09
6
234 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
WinWaitActive parameters 12 31
VBA "SendKeys" Syntax for Multiple Keystrokes 7 98
centeredAverage challenge 8 124
FizzBuzz challenge 9 73
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now