Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 03, 2016, 10:02:13 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Q2 [Ans.] Killing a created process from outside the function that creates it  (Read 2051 times)

mediaguycouk

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 245
    • View Profile
    • Mediaguy
    • Donate to Member
Another question I'm stuck on.

I have two forms (for this example) called Main and Ffmpeg. Inside main there is a [Start] and a [Cancel] button. There is a Start_Clicked function and a Cancel_Clicked function.

Inside Start_Click I start ffmpeg (Ffmpeg ffmpeg = new Ffmpeg). This ffmpeg class opens up ffmpeg.exe and sends some arguments. (The code is in http://www.donationc...ex.php?topic=15549.0)

Now my question is, how can I send proc.Kill(); to ffmpeg? The Cancel_Clicked function doesn't know what ffmpeg is.

Advanced thanks for your help. Learning languages is damn near impossible without people like yourself that help!

Graham
Learning C# - Graham Robinson
« Last Edit: November 04, 2008, 03:28:40 AM by mediaguycouk »

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
Re: Q2 Killing a created process from outside the function that creates it
« Reply #1 on: November 03, 2008, 04:13:06 AM »
You'll want to declare the instance of the ffmpeg class outside of the functions (in a global context), then make use of it within the functions. To show you how this would work we'd need to see more of your code.

Ehtyar.

mediaguycouk

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 245
    • View Profile
    • Mediaguy
    • Donate to Member
Re: Q2 Killing a created process from outside the function that creates it
« Reply #2 on: November 04, 2008, 03:27:51 AM »
That's so simple it's brilliant. Why the hell didn't I think of that! I've even done that in a different part of the program.

Learning C# - Graham Robinson