Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to terminate current applications running?

Posted on 2000-03-21
5
Medium Priority
?
279 Views
Last Modified: 2010-08-05
I have an application which send a broadcast message to get the current tasks of a few applications which are currently running or not running. Following is an example of 16 bit application:
 
 //  Fill the m_ahtActiveList array with the Task handles of all active tasks
    //  This will also inform the Task that they need to exit
    //
    ::SendMessage(HWND_BROADCAST, RegisterWindowMessage(DNLDCOPY_MSG),
                  0, (LONG)(HTASK *)m_ahtActiveList);
   
where,
HTASK   m_ahtActiveList[5];

Before my application start processing(installing program), it need to close all the application that currently running. In 16 bit, there are GetCurrentTask() and IsTask() that would help to do the job. Is there any similar function in 32 bit? I would appreciate if anybody help me on this problem.
   
0
Comment
Question by:EKarim
[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
5 Comments
 
LVL 3

Expert Comment

by:ufolk123
ID: 2642958
Hi Ekarim,

You can use the Toolhelp APIs to enumerate all prcoesses currently tunning on the system ( Win95) .Then you need to open each process using openprocess() and call terminateprocess()


0
 

Author Comment

by:EKarim
ID: 2645785
Hi ufolk123,

Thanks for you reply. It took me longer to see your answer because I did not receive the e-mail after you posted your answer. Anyhow, Is there any limitation to enumerate process using ToolHelp API in Windows NT? My application should be able to run both in Win95 and Windows NT. I do not have any prior experience in ToolHelp API. Could you please write me in details about the functions that I need to accomplish the job. Do I still have to send a broadcast message to other executables? I only have to terminate 5 executables before my application start installing the files. Again, thanks for your help.
0
 

Author Comment

by:EKarim
ID: 2646606
Hi All,

I can not accept this because my application need to wait until closing all the applications gracefully. For example, if the printer application is running, my appliction need to wait until the printer application finish printing. I will highly appreciate if you go over my above posted questions if ToolHelp API is the best way to solve the problem. Thanks,

EKarim
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 75 total points
ID: 2647821
1.   HOWTO: Terminate an Application "Cleanly" in Win32
http://support.microsoft.com/support/kb/articles/Q178/8/93.ASP
2. //Processes list and kill by name
http://www.codeguru.com/win32/ps.shtml

In there articles you can find source
text for finding and closing 32b apps
for Windows 95/NT.
I hope, it helps. Alex
0
 

Author Comment

by:EKarim
ID: 2655507
I did not get all the answers. I am closing this because I know where I can start to solve the problem. Thanks for your help.

EKarim
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

719 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