Solved

How to find out what program is running and terminate it?

Posted on 1998-03-09
6
184 Views
Last Modified: 2010-04-10
How to find out what program is running and terminate it?
e.g winword.
And what if a few instance of it is running?
0
Comment
Question by:stl
  • 3
  • 3
6 Comments
 
LVL 11

Expert Comment

by:alexo
ID: 1183305
If you want your program to run on Win95, you can use the ToolHelp functions.
Search for "Taking a Snapshot and Viewing Processes" in your MSVC documentation.
0
 

Author Comment

by:stl
ID: 1183306
I get a unhandled exception when I run the GetProcessList()!

Can anyone teach me how to compile the PView95 source code?
0
 

Author Comment

by:stl
ID: 1183307
Anyway I just want to close all winword that might be running.
Any sugguestion?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 11

Accepted Solution

by:
alexo earned 30 total points
ID: 1183308
Oh, why didn't you say so in the first place?

Here ya go:

#define STRICT
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#define WORD_CAPTION    "Microsoft Word"

BOOL CALLBACK FindWord(HWND hwnd, LPARAM lparam)
{
    char text[sizeof WORD_CAPTION];
    int len = GetWindowText(hwnd, text, sizeof WORD_CAPTION);
    if (len == (sizeof WORD_CAPTION - 1) && !lstrcmp(text, WORD_CAPTION))
        PostMessage(hwnd, WM_QUIT, 0, 0);
    return TRUE;
}

void main()
{
    EnumWindows(FindWord, 0);
}

0
 

Author Comment

by:stl
ID: 1183309
To alexo,
Can you teach me how to compile the PView95 source code?
Using Visual C ++ 5.

Thanks in advance.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1183310
I'm a bit stressed at work at the moment.
What seems to be the problem with the PView95 source?
If you have the makefile, just open it in the compiler and shoot.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

914 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

21 Experts available now in Live!

Get 1:1 Help Now