Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Killing a process in Windows 95

Posted on 1998-07-09
6
Medium Priority
?
242 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
[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
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 300 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

604 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