简体   繁体   English

从.exe文件获取返回值到xulrunner

[英]get return value from .exe file to xulrunner

I have a .exe MFC file that i want to call it with xulrunner .i use from launch command but i can't return value from .exe file . 我有一个.exe MFC文件,我想用xulrunner .i从启动命令中调用它,但是我无法从.exe文件返回值。

can anybody help me how i can do it ? 有人可以帮我怎么做吗?

    var file = Components.classes["@mozilla.org/file/local;1"]
        .createInstance(Components.interfaces.nsILocalFile);

    var filePath =Components.classes["@mozilla.org/file/directory_service;1"]
            .getService(Components.interfaces.nsIProperties)
            .get("AChrom", Components.interfaces.nsIFile).parent;

    file.initWithPath("file.exe");
    file.launch();

If you want return value use 'nsIProcess' : 如果要返回值,请使用“ nsIProcess”:

var file = Components.classes["@mozilla.org/file/local;1"]
                     .createInstance(Components.interfaces.nsIFile);
file.initWithPath("c:\\myapp.exe");
var process = Components.classes["@mozilla.org/process/util;1"]
                        .createInstance(Components.interfaces.nsIProcess);
process.init(file);
var args = ["argument1", "argument2"];
process.run(true, args, args.length);
var retVal=process.exitValue;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM