Solved

URGENT: terminate an open program (ex. QuickTime) when a button is clicked.

Posted on 2004-08-20
7
196 Views
Last Modified: 2011-04-14
HI,

I have a program with several states. One is encoding and the other is resting.

WHen i click a button - 'Start Encode' a thread starts that encodes some input. It also fires up an instance of QuickTime in the same thread (WinExec used)

Now, when i click - "Stop Encode" it stops the encoding ..but.. QuickTime remains open.

Can someone tell me how to close an open program (something like an automated End Process in Task Manager)?

It would be great if i could receive and answer before Saturday night (Aug 20,2004).

Thank you all so much,
0
Comment
Question by:marijanav
[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
  • 2
7 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 450 total points
ID: 11857399
Check out http://support.microsoft.com/default.aspx?scid=KB;en-us;178893& ("How To Terminate an Application "Cleanly" in Win32"). To find the process ID you need there, see http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q175/0/30.ASP&NoWebContent=1 ("How To Enumerate Applications Using Win32 APIs"). Both articles come with full sample code.
0
 

Author Comment

by:marijanav
ID: 11857650
thanks

i'll look at it now. :)
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 11857946
Addition to jkr's answer:
Replace WinExec with CreateProcess. In this case you have created process handle returned in lpProcessInformation->hProcess. Having this handle you can test whether this process is active (see GetExitCodeProcess) and use this handle to terminate the process.
0
 
LVL 86

Expert Comment

by:jkr
ID: 12091905
IMHO this Q is answered.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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…
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.

732 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