0 Replies Latest reply on Oct 24, 2008 11:04 AM by 843804

    JACOB need to get to methods inside Variant

      --------------------my Venice class
      package model;

      import com.jacob.com.*;
      import com.jacob.activeX.*;

      public class Venice {
           ActiveXComponent veniceDll = new ActiveXComponent("ClSdk.Venice");
           public Venice() {
           public boolean logonDialog(String version, String appName) {
                return Dispatch.call(veniceDll, "LogonDialog", version, appName).getBoolean();
           public Variant[] getCabinets() {
                return Dispatch.call(veniceDll, "GetCabinets").toSafeArray().toVariantArray();
           public Variant[] getDossiers(String cabinet) {
                Variant[] dossiers = Dispatch.call(veniceDll, "GetDossiers", cabinet).toSafeArray().toVariantArray();
                return dossiers;

      ------------------------------my class with main method
      public class Test {
           public static void main(String[] args)
                Venice venice = new Venice();
                venice.logonDialog("7.40a", "sdk");
                Variant[] cabinets = venice.getCabinets();
                for (Variant cabinet : cabinets) {
                Variant[] dossiers = venice.getDossiers("\\\\Citrix02\\Venice\\Data\\6_Test");
                for (Variant dossier: dossiers) {
                     if (dossier.toString().equalsIgnoreCase("bvm")){
                          //Dispatch.call(dossier.toDispatch(), "AMethod"); <----------------

      I want to access the methods from dossier. Using dossier.toDispatch() gives the error:
      Exception in thread "main" com.jacob.com.ComFailException: VariantChangeType failed
           at com.jacob.com.Variant.toVariantDispatch(Native Method)
           at com.jacob.com.Variant.toDispatch(Variant.java:1996)
           at model.Test.main(Test.java:28)

      Anyone who knows how else I can get to the methods native to dossier?