reorganized the samples, again. Moved the programs that were more test cases to the unit test directory and repackaged the unit test directory.

This commit is contained in:
clay_shooter
2006-03-18 16:21:28 +00:00
parent 288b2da21a
commit 4eb49215cb
61 changed files with 767 additions and 711 deletions

View File

@@ -0,0 +1,42 @@
package com.jacob.test.safearray;
import com.jacob.com.*;
import com.jacob.activeX.*;
class sa_dispatch
{
public static void main(String args[])
{
// deprecated
//System.runFinalizersOnExit(true);
try {
String lang = "VBScript";
ActiveXComponent sC = new ActiveXComponent("ScriptControl");
Dispatch sControl = (Dispatch)sC.getObject();
Dispatch.put(sControl, "Language", lang);
Variant result = Dispatch.call(sControl, "Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
// wrap the script control in a variant
Variant v = new Variant(sControl);
// create a safe array of type dispatch
SafeArray sa = new SafeArray(Variant.VariantDispatch, 1);
// put the variant in the array
sa.setVariant(0, v);
// take it back out
Variant v2 = sa.getVariant(0);
Dispatch d = v2.toDispatch();
// make sure you can call eval on it
result = Dispatch.call(d, "Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
} catch (ComException e) {
e.printStackTrace();
}
}
}