Package com.jacob.activeX

Examples of com.jacob.activeX.ActiveXComponent.invoke()


    try {
      Thread.sleep(10000);
    } catch (InterruptedException ie) {
    }
    instance1.invoke("Quit", new Variant[] {});
    instance2.invoke("Quit", new Variant[] {});
    ComThread.Release();

  }

  /**
 
View Full Code Here


          .println("This test only works if MS Word is NOT already running");
      String mApplicationId = "Word.Application";
      ActiveXComponent mTryConnectingFirst = ActiveXComponent
          .connectToActiveInstance(mApplicationId);
      if (mTryConnectingFirst != null) {
        mTryConnectingFirst.invoke("Quit", new Variant[] {});
        System.out
            .println("Was able to connect to MSWord when hadn't started it");
      } else {
        System.out
            .println("Correctly could not connect to running MSWord");
View Full Code Here

      if (mTryConnectingThird == null) {
        fail("Was unable able to connect to MSWord after previous startup");
      } else {
        System.out.println("Stopping MSWord");
        // stop it so we can fail trying to connect to a running
        mTryConnectingThird.invoke("Quit", new Variant[] {});
      }
      Thread.sleep(2000);
      ActiveXComponent mTryConnectingFourth = ActiveXComponent
          .connectToActiveInstance(mApplicationId);
      if (mTryConnectingFourth != null) {
View Full Code Here

      }
      Thread.sleep(2000);
      ActiveXComponent mTryConnectingFourth = ActiveXComponent
          .connectToActiveInstance(mApplicationId);
      if (mTryConnectingFourth != null) {
        mTryConnectingFourth.invoke("Quit", new Variant[] {});
        fail("Was able to connect to MSWord that was stopped");
      } else {
        System.out
            .println("Correctly could not connect to running MSWord");
      }
View Full Code Here

      Variant f = new Variant(false);
      Dispatch.call(doc, "Close", f);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      app.invoke("Quit", new Variant[] {});
    }
  }

  /**
   * WORD转HTML
 
View Full Code Here

      Dispatch.call(excel, "Close", f);
      org.jeecgframework.core.util.LogUtil.info("wordtohtml转换成功");
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      app.invoke("Quit", new Variant[] {});
    }
  }

  /**
   * 读文件到字符串
 
View Full Code Here

    String connectStr = String.format("winmgmts:\\\\%s\\root\\CIMV2", host);
    String query = "SELECT * FROM Win32_PerfRawData_Tcpip_NetworkInterface"; //Started = 1 means the service is running.
    ActiveXComponent axWMI = new ActiveXComponent(connectStr);
    //Execute the query
                Variant[] vs = {new Variant(query)};
    Variant vCollection = axWMI.invoke("ExecQuery", vs);
   
    //Our result is a collection, so we need to work though the.
    EnumVariant enumVariant = new EnumVariant(vCollection.toDispatch());
    Dispatch item = null;
    while (enumVariant.hasMoreElements()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.