ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Q2 [Ans.] Killing a created process from outside the function that creates it

(1/1)

mediaguycouk:
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.donationcoder.com/forum/index.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

Ehtyar:
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:
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.

Navigation

[0] Message Index

Go to full version