?
Solved

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

Posted on 2004-08-20
7
Medium Priority
?
202 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 1800 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

Technology Partners: 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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

801 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