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

How to find out what program is running and terminate it?
e.g winword.
And what if a few instance of it is running?
stlAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alexoCommented:
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.
stlAuthor Commented:
I get a unhandled exception when I run the GetProcessList()!

Can anyone teach me how to compile the PView95 source code?
stlAuthor Commented:
Anyway I just want to close all winword that might be running.
Any sugguestion?
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

alexoCommented:
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);
}

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stlAuthor Commented:
To alexo,
Can you teach me how to compile the PView95 source code?
Using Visual C ++ 5.

Thanks in advance.
alexoCommented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.