Solved

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

Posted on 2004-08-20
7
192 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 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 learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

895 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

18 Experts available now in Live!

Get 1:1 Help Now