topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Friday December 13, 2024, 2:22 am
  • Proudly celebrating 15+ 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 4590 times)

mediaguycouk

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 247
    • 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 https://www.donation...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 AM by mediaguycouk »

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
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: 247
    • View Profile
    • Mediaguy
    • Donate to Member
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