var fpath="C:\\TVT_"+cur_date+"_"+cur_time+".avi";
Components.utils.import("resource://gre/modules/FileUtils.jsm");
var env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
var shell = new FileUtils.File(env.get("COMSPEC"));
var args = ["/c", "cd.. & cd.. & C: & cd C:/ffmpeg/bin & record.bat "+fpath];
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(shell);
process.runAsync(args, args.length);
- I don’t want to use taskkill.exe, /MIN, /C, /B, rather I want to quit this ffmpeg process
- I read about CMDOW but did not find cmdow.exe inside system32 directory.
- So how can I send quit command within the same window which is running ffmpeg process?
Using Windows XP service pack 2 with Firefox 12
Thanks..
That’s not quite trivial – Firefox doesn’t have any built-in functionality for that meaning that you would need to use js-ctypes for that and call Win32 API functions directly. Win32 – Get Main Wnd Handle of application describes how you would get hold of the top-level window for an application, after that you can send
WM_QUITmessage to it. This approach actually works:I tested this and could successfully close a Notepad window with it (the usual warning will appear if the text hasn’t been saved so it is a clean shutdown). In your case the problem might be however that you aren’t running your ffmpeg directly but rather via the command line shell – so you will close the command line window which might not terminate ffmpeg. I guess you will just have to try, if it doesn’t work you will probably have to look at the title of the window instead of its process ID (which is obviously a less reliable approach).