Solved

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

Posted on 1998-03-09
6
183 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
Comment Utility
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
Comment Utility
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
Comment Utility
Anyway I just want to close all winword that might be running.
Any sugguestion?
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 11

Accepted Solution

by:
alexo earned 30 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

763 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

14 Experts available now in Live!

Get 1:1 Help Now