zoukankan      html  css  js  c++  java
  • [AIR] 与本地进程(应用程序)进行通讯

    毫不夸张的说,此功能可以将Windows命令行程序(cmd.exe)通过AIR应用封装起来,并指挥它做任何你想做的事情

    AIR2.0及以上与本地进程的交互主要体现在以下几方面:

    • 启动进程并提供初始参数

    • 向进程写入数据

    • 读取进程的输出数据

    当然,Adobe始终把平台运行时的安全因素放在首位。如果你希望你的AIR应用能有与本地进程交互,需要注意以下限制:

    • 必须通过操作系统的安装工具来部署,不能直接使用AIR包进行安装(AIR是跨平台的文件格式)。

    • 不能启动位于当前AIR应用程序文件夹中的进程。

    • 必须在AIR应用程序描述文件指明supportProfiles为extendedDesktop(或使用AIR命令行工具指明该参数)。

      var nativeProcess:NativeProcess = new NativeProcess();
      var npsi:NativeProcessStartupInfo = new NativeProcessStartupInfo();
      var file:File = File.resolvePath("C:/Program Files/数字白板教案释放工具/zPack.exe");
      npsi.executable = file;//npsi.workingDirectory = File.desktopDirectory;
      var args: Vector.<String> = new Vector.<String>;
      args.push("C:/Users/johun/Desktop/Desktop.zpack");//向zPack.exe应用程序传参
      args.push("E:/");//向zPack.exe应用程序传参
      npsi.arguments= args;
      nativeProcess.start(npsi);
      /*当 autoExit 为 true(默认值)时,如果关闭了所有窗口,则应用程序将终止。调度 exiting 和 exit 事件。如果 autoExit 为 false,则必须调用 NativeApplication.nativeApplication.exit() 才能终止应用程序。*/
      NativeApplication.nativeApplication.autoExit = true;

      注意:在发布时生成的-app.xml中需在<application xmlns="http://ns.adobe.com/air/application/2.6">后面加上<supportedProfiles>extendedDesktop </supportedProfiles>

  • 相关阅读:
    关键词user附近有语法错误
    Java期末考试冲刺总结
    getElementsByName&getElementById
    window.location.herf传值问题
    三种提示框
    statement没有返回结果集问题
    ajax从jsp向servlet传值
    java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)报错问题解决
    Unregistering application product with eureka with status DOWN
    输出废弃
  • 原文地址:https://www.cnblogs.com/frost-yen/p/4316074.html
Copyright © 2011-2022 走看看