Solved

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

Posted on 2004-08-20
7
191 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
Comment Utility
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
Comment Utility
thanks

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

Expert Comment

by:AlexFM
Comment Utility
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
Comment Utility
IMHO this Q is answered.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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…
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 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.

771 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

15 Experts available now in Live!

Get 1:1 Help Now