Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 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

610 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