diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 0000000..dd03ddf
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,11 @@
+jacob.dll
+jacob.jar
+jacobdll.jar
+*.zip
+RELEASE.txt
+.project
+.classpath
+compilation_tools.properties
+version.properties
+release
+
diff --git a/README.TXT b/README.TXT
deleted file mode 100644
index dbfa0ff..0000000
--- a/README.TXT
+++ /dev/null
@@ -1,28 +0,0 @@
-For documentation see: http://users.rcn.com/danadler/jacob/
-
-The java code is in com\jacob\*.
-
-The C++ code is in .\jni.
-
-To build, run:
-
-nmake -f makefile
-
-That will first compile the JAVA files and build the JAR file, and
-then compile the C++ code and build the DLL.
-
-Building the jni:
-
-The following are hardcoded into the makefile, so you may have to
-change it. I developed this with the C++ compiler and ATL version
-that ship with VC++ 6.0, so I'm not sure if different versions will
-work.
-
-I have compiled this against JDK 1.1.6 and 1.2.2 as well as Microsoft
-SDK for Java 3.2 as the JDK setting.
-
-DEST_DIR is a destination directory into which to copy the final DLL.
-
-JDK = d:\j2sdk1.4.2_06
-DEST_DIR = d:\jacob
-MSDEVDIR = d:\apps\\"Microsoft Visual Studio"\VC98
diff --git a/WhatsNew.html b/WhatsNew.html
deleted file mode 100644
index 85c6bb3..0000000
--- a/WhatsNew.html
+++ /dev/null
@@ -1,114 +0,0 @@
-
What's New in JACOB 1.8
-
-
-
-Move To SourceForge
-The project is not housed at
-Sourceforge.net.
-
-
-
-Licensing Change
-All limitations on commercial use of JACOB have been removed and it
-is now being developed under a BSD license at
-Sourceforge.net.
-
-
-
-Compiled with Java 1.4.2
-Version 1.8 was compiled with JSEE 1.4.2 and fixes the compilation bug
-that was remnant of compilation with JDK 1.1.
-
-
-
-Baseline For Change
-This version is the baseline for the first CVS checkin and we encourage
-people to start contributing to the project with this version.
-
-
-
-
-
-
What's New in JACOB 1.7
-
-
-
-Explicit COM Threading Model Support:
-See a detailed discussion of
-COM Apartments in JACOB
-
-Improved Event Handling:
-Thanks to code contributed by
-
-Niels Olof Bouvin
-and Henning Jae JACOB 1.7 can
-read the type information of a Connection Point interface by looking
-it up in the registry. This makes it possible to use events with IE as
-well as office products.
-
-
-
-
-Improved Dispatch:
-Error messages from Invoke failures are now printed out as well as
-allowing the passing in of arguments to a Get method.
-
-
-
-EnumVariant Implementation:
-Makes it easier to iterate over COM collections. Thanks to code
-contributed by
-Thomas Hallgren.
-
-
-
-SafeArray leaks:
-SafeArrays were not being properly freed prior to version 1.7, many
-other memory leaks were fixed as well.
-
-
-
-Visual Studio Project:
-For those who want to debug: vstudio/jacob. At the moment all the
-native code is replicated there from the jni directory...
-
-
-
-
Related Links
-
-
-The JACOB mailing list is hosted at yahoo groups:
-
-http://groups.yahoo.com/group/jacob-project.
-This is the preferred way to get support for JACOB. It also
-includes an extensive archive. If you are doing any development with
-JACOB, please join the list.
-
-To find documentation on the com.ms.com package, go to:
-
-http://www.microsoft.com/java/download/dl_sdk40.htm
-and at the bottom of the page is a link that says:
-Microsoft SDK for Java 4.0 Documentation Only. You should download
-that file and install it. Then, view sdkdocs.chm and look for
-"Microsoft Packages Reference". Hopefully, the next release of
-JACOB will include full javadoc (volunteers?)...
-
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..3086c06
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,267 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Building java classes...
+
+ Building java sample classes...
+
+ Building java test classes...
+
+
+
+
+ Removing old jars
+
+ Packaging java classes...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clean up the target folders and file, for safety
+
+ Compiling C++ classes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clean up the target folders and file, for safety
+
+ Creating jacob.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Java Com Bridge (Jacob)]]>
+ See Jacob-project on Sourceforge for more info]]>
+
+
+
+
+
+
+
+
+
+
+
+
+ Packaging release...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/com/jacob/activeX/ActiveXComponent.java b/com/jacob/activeX/ActiveXComponent.java
deleted file mode 100644
index 8195c5a..0000000
--- a/com/jacob/activeX/ActiveXComponent.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1999-2004 Sourceforge JACOB Project.
- * All rights reserved. Originator: Dan Adler (http://danadler.com).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Redistributions in any form must be accompanied by information on
- * how to obtain complete source code for the JACOB software.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jacob.activeX;
-
-import com.jacob.com.*;
-
-/**
- * This class simulates com.ms.activeX.ActiveXComponent only as it used for
- * creating Dispatch objects
- */
-public class ActiveXComponent extends Dispatch {
- /**
- * @param progid
- */
- public ActiveXComponent(String progid) {
- super(progid);
- }
-
- /**
- * @return actually returns this bject
- */
- public Object getObject() {
- return this;
- }
-
- /**
- * @param name
- * @param args
- * @return Variant result of the invoke
- */
- public Variant invoke(String name, Variant[] args) {
- return Dispatch.callN(this, name, args);
- }
-
- /**
- * @param name property name
- * @return Variant value of property
- */
- public Variant getProperty(String name) {
- return Dispatch.get(this, name);
- }
-
- /**
- * @param name
- * @param arg
- */
- public void setProperty(String name, Variant arg) {
- Dispatch.put(this, name, arg);
- }
-
- /**
- * @see com.jacob.com.Dispatch#finalize()
- */
- protected void finalize() {
- super.finalize();
- }
-
- static {
- System.loadLibrary("jacob");
- }
-}
\ No newline at end of file
diff --git a/com/jacob/com/Dispatch.java b/com/jacob/com/Dispatch.java
deleted file mode 100644
index d22d966..0000000
--- a/com/jacob/com/Dispatch.java
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
- * Copyright (c) 1999-2004 Sourceforge JACOB Project.
- * All rights reserved. Originator: Dan Adler (http://danadler.com).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Redistributions in any form must be accompanied by information on
- * how to obtain complete source code for the JACOB software.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jacob.com;
-
-import java.lang.reflect.Array;
-
-/**
- * Object represents MS level dispatch object. You're going to live here
- * a lot
- */
-public class Dispatch extends JacobObject
-{
- /**
- * This is public because Dispatch.cpp knows its name and accesses
- * it directly to get the disptach id. You really can't rename
- * it or make it private
- */
- public int m_pDispatch;
- /** program Id passed in by ActiveX components in their constructor */
- private String programId = null;
-
- public static final int LOCALE_SYSTEM_DEFAULT = 2048;
- public static final int Method = 1;
- public static final int Get = 2;
- public static final int Put = 4;
- public static final int PutRef = 8;
- public static final int fdexNameCaseSensitive = 1;
- public static final int DISPID_UNKNOWN = -1;
- public static final int DISPID_VALUE = 0;
- public static final int DISPID_PROPERTYPUT = -3;
- public static final int DISPID_NEWENUM = -4;
- public static final int DISPID_EVALUATE = -5;
- public static final int DISPID_CONSTRUCTOR = -6;
- public static final int DISPID_DESTRUCTOR = -7;
- public static final int DISPID_COLLECT = -8;
- public static final int DISPID_AUTOSIZE = -500;
- public static final int DISPID_BACKCOLOR = -501;
- public static final int DISPID_BACKSTYLE = -502;
- public static final int DISPID_BORDERCOLOR = -503;
- public static final int DISPID_BORDERSTYLE = -504;
- public static final int DISPID_BORDERWIDTH = -505;
- public static final int DISPID_DRAWMODE = -507;
- public static final int DISPID_DRAWSTYLE = -508;
- public static final int DISPID_DRAWWIDTH = -509;
- public static final int DISPID_FILLCOLOR = -510;
- public static final int DISPID_FILLSTYLE = -511;
- public static final int DISPID_FONT = -512;
- public static final int DISPID_FORECOLOR = -513;
- public static final int DISPID_ENABLED = -514;
- public static final int DISPID_HWND = -515;
- public static final int DISPID_TABSTOP = -516;
- public static final int DISPID_TEXT = -517;
- public static final int DISPID_CAPTION = -518;
- public static final int DISPID_BORDERVISIBLE = -519;
- public static final int DISPID_APPEARANCE = -520;
- public static final int DISPID_MOUSEPOINTER = -521;
- public static final int DISPID_MOUSEICON = -522;
- public static final int DISPID_PICTURE = -523;
- public static final int DISPID_VALID = -524;
- public static final int DISPID_READYSTATE = -525;
- public static final int DISPID_REFRESH = -550;
- public static final int DISPID_DOCLICK = -551;
- public static final int DISPID_ABOUTBOX = -552;
- public static final int DISPID_CLICK = -600;
- public static final int DISPID_DBLCLICK = -601;
- public static final int DISPID_KEYDOWN = -602;
- public static final int DISPID_KEYPRESS = -603;
- public static final int DISPID_KEYUP = -604;
- public static final int DISPID_MOUSEDOWN = -605;
- public static final int DISPID_MOUSEMOVE = -606;
- public static final int DISPID_MOUSEUP = -607;
- public static final int DISPID_ERROREVENT = -608;
- public static final int DISPID_READYSTATECHANGE = -609;
- public static final int DISPID_AMBIENT_BACKCOLOR = -701;
- public static final int DISPID_AMBIENT_DISPLAYNAME = -702;
- public static final int DISPID_AMBIENT_FONT = -703;
- public static final int DISPID_AMBIENT_FORECOLOR = -704;
- public static final int DISPID_AMBIENT_LOCALEID = -705;
- public static final int DISPID_AMBIENT_MESSAGEREFLECT = -706;
- public static final int DISPID_AMBIENT_SCALEUNITS = -707;
- public static final int DISPID_AMBIENT_TEXTALIGN = -708;
- public static final int DISPID_AMBIENT_USERMODE = -709;
- public static final int DISPID_AMBIENT_UIDEAD = -710;
- public static final int DISPID_AMBIENT_SHOWGRABHANDLES = -711;
- public static final int DISPID_AMBIENT_SHOWHATCHING = -712;
- public static final int DISPID_AMBIENT_DISPLAYASDEFAULT = -713;
- public static final int DISPID_AMBIENT_SUPPORTSMNEMONICS = -714;
- public static final int DISPID_AMBIENT_AUTOCLIP = -715;
- public static final int DISPID_AMBIENT_APPEARANCE = -716;
- public static final int DISPID_AMBIENT_CODEPAGE = -725;
- public static final int DISPID_AMBIENT_PALETTE = -726;
- public static final int DISPID_AMBIENT_CHARSET = -727;
- public static final int DISPID_AMBIENT_TRANSFERPRIORITY = -728;
-
-
- // map args based on msdn doc
- protected static Variant obj2variant(Object o) {
- if (o == null)
- return new Variant();
- if (o instanceof Variant)
- return (Variant) o;
- if (o instanceof Integer)
- return new Variant(((Integer) o).intValue());
- if (o instanceof String)
- return new Variant((String) o);
- if (o instanceof Boolean)
- return new Variant(((Boolean) o).booleanValue());
- if (o instanceof Double)
- return new Variant(((Double) o).doubleValue());
- if (o instanceof Float)
- return new Variant(((Float) o).floatValue());
- if (o instanceof SafeArray)
- return new Variant((SafeArray) o);
- if (o instanceof Dispatch) {
- Variant v = new Variant();
- v.putObject((Dispatch) o);
- return v;
- }
- // automatically convert arrays using reflection
- Class c1 = o.getClass();
- SafeArray sa = null;
- if (c1.isArray()) {
- int len1 = Array.getLength(o);
- Object first = Array.get(o, 0);
- if (first.getClass().isArray()) {
- int max = 0;
- for (int i = 0; i < len1; i++) {
- Object e1 = Array.get(o, i);
- int len2 = Array.getLength(e1);
- if (max < len2) {
- max = len2;
- }
- }
- sa = new SafeArray(Variant.VariantVariant, len1, max);
- for (int i = 0; i < len1; i++) {
- Object e1 = Array.get(o, i);
- for (int j = 0; j < Array.getLength(e1); j++) {
- sa.setVariant(i, j, obj2variant(Array.get(e1, j)));
- }
- }
- } else {
- sa = new SafeArray(Variant.VariantVariant, len1);
- for (int i = 0; i < len1; i++) {
- sa.setVariant(i, obj2variant(Array.get(o, i)));
- }
- }
- return new Variant(sa);
- }
- throw new ClassCastException("cannot convert to Variant");
- }
-
- /**
- * same as above, for an array
- * @param o
- * @return Variant[]
- */
- protected static Variant[] obj2variant(Object[] o) {
- Variant vArg[] = new Variant[o.length];
- for (int i = 0; i < o.length; i++) {
- vArg[i] = obj2variant(o[i]);
- }
- return vArg;
- }
-
- /**
- * zero argument constructor that sets the dispatch pointer to 0
- */
- public Dispatch() {
- m_pDispatch = 0;
- }
-
- /**
- * Constructor that calls createInstance with progid. This is the
- * constructor used by the ActiveXComponent
- *
- * @param requestedProgramId
- */
- public Dispatch(String requestedProgramId) {
- programId = requestedProgramId;
- createInstance(requestedProgramId);
- }
-
- /**
- * return a different interface by IID string
- *
- * @param iid
- * @return Dispatch a disptach that matches ??
- */
- public native Dispatch QueryInterface(String iid);
-
- /**
- * Constructor that only gets called from JNI
- *
- * @param pDisp
- */
- protected Dispatch(int pDisp) {
- m_pDispatch = pDisp;
- }
-
- /**
- * native call createIstnace only used by the constructor with the same parm
- * type could this be private?
- *
- * @param progid
- */
- protected native void createInstance(String progid);
-
- /**
- * returns the program id if an activeX component created this
- * otherwise it returns null. This was added to aid in debugging
- * @return the program id an activeX component was created against
- */
- public String getProgramId(){
- return programId;
- }
-
- /**
- * call this to explicitly release the com object before gc
- */
- public native void release();
-
- /**
- * not implemented yet
- *
- * @param disp
- * @param name
- * @param val
- * @throws ClassCastException
- * because???
- */
- public static void put_Casesensitive(Object disp, String name, Object val) {
- throw new ClassCastException("not implemented yet");
- }
-
- // eliminate _Guid arg
- public static void invokeSubv(Object disp, String name, int dispID,
- int lcid, int wFlags, Variant[] vArg, int[] uArgErr) {
- invokev(disp, name, dispID, lcid, wFlags, vArg, uArgErr);
- }
-
- public static void invokeSubv(Object disp, String name, int wFlags,
- Variant[] vArg, int[] uArgErr) {
- invokev(disp, name, 0, LOCALE_SYSTEM_DEFAULT, wFlags, vArg, uArgErr);
- }
-
- public static void invokeSubv(Object disp, int dispID, int wFlags,
- Variant[] vArg, int[] uArgErr) {
- invokev(disp, null, dispID, LOCALE_SYSTEM_DEFAULT, wFlags, vArg,
- uArgErr);
- }
-
- public static Variant callN_CaseSensitive(Object disp, String name,
- Object[] values) {
- throw new ClassCastException("not implemented yet");
- }
-
- public static void callSubN(Object disp, String name, Object[] args) {
- invokeSubv(disp, name, Method | Get, obj2variant(args),
- new int[args.length]);
- }
-
- public static void callSubN(Object disp, int dispID, Object[] args) {
- invokeSubv(disp, dispID, Method | Get, obj2variant(args),
- new int[args.length]);
- }
-
- public static int getIDOfName(Object disp, String name) {
- int ids[] = getIDsOfNames(disp, LOCALE_SYSTEM_DEFAULT,
- new String[] { name });
- return ids[0];
- }
-
- // eliminated _Guid argument
- public static native int[] getIDsOfNames(Object disp, int lcid,
- String[] names);
-
- // eliminated _Guid argument
- public static int[] getIDsOfNames(Object disp, String[] names) {
- return getIDsOfNames(disp, LOCALE_SYSTEM_DEFAULT, names);
- }
-
- public static Variant callN(Object disp, String name, Object[] args) {
- return invokev(disp, name, Method | Get, obj2variant(args),
- new int[args.length]);
- }
-
- public static Variant callN(Object disp, int dispID, Object[] args) {
- return invokev(disp, dispID, Method | Get, obj2variant(args),
- new int[args.length]);
- }
-
- public static Variant invoke(Object disp, String name, int dispID,
- int lcid, int wFlags, Object[] oArg, int[] uArgErr) {
- return invokev(disp, name, dispID, lcid, wFlags, obj2variant(oArg),
- uArgErr);
- }
-
- public static Variant invoke(Object disp, String name, int wFlags,
- Object[] oArg, int[] uArgErr) {
- return invokev(disp, name, wFlags, obj2variant(oArg), uArgErr);
- }
-
- public static Variant invoke(Object disp, int dispID, int wFlags,
- Object[] oArg, int[] uArgErr) {
- return invokev(disp, dispID, wFlags, obj2variant(oArg), uArgErr);
- }
-
- public static Variant call(Object disp, String name) {
- return callN(disp, name, new Variant[0]);
- }
-
- public static Variant call(Object disp, String name, Object a1) {
- return callN(disp, name, new Object[] { a1 });
- }
-
- public static Variant call(Object disp, String name, Object a1, Object a2) {
- return callN(disp, name, new Object[] { a1, a2 });
- }
-
- public static Variant call(Object disp, String name, Object a1, Object a2,
- Object a3) {
- return callN(disp, name, new Object[] { a1, a2, a3 });
- }
-
- public static Variant call(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4) {
- return callN(disp, name, new Object[] { a1, a2, a3, a4 });
- }
-
- public static Variant call(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4, Object a5) {
- return callN(disp, name, new Object[] { a1, a2, a3, a4, a5 });
- }
-
- public static Variant call(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6) {
- return callN(disp, name, new Object[] { a1, a2, a3, a4, a5, a6 });
- }
-
- public static Variant call(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6, Object a7) {
- return callN(disp, name, new Object[] { a1, a2, a3, a4, a5, a6, a7 });
- }
-
- public static Variant call(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) {
- return callN(disp, name,
- new Object[] { a1, a2, a3, a4, a5, a6, a7, a8 });
- }
-
- public static Variant call(Object disp, int dispid) {
- return callN(disp, dispid, new Variant[0]);
- }
-
- public static Variant call(Object disp, int dispid, Object a1) {
- return callN(disp, dispid, new Object[] { a1 });
- }
-
- public static Variant call(Object disp, int dispid, Object a1, Object a2) {
- return callN(disp, dispid, new Object[] { a1, a2 });
- }
-
- public static Variant call(Object disp, int dispid, Object a1, Object a2,
- Object a3) {
- return callN(disp, dispid, new Object[] { a1, a2, a3 });
- }
-
- public static Variant call(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4) {
- return callN(disp, dispid, new Object[] { a1, a2, a3, a4 });
- }
-
- public static Variant call(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4, Object a5) {
- return callN(disp, dispid, new Object[] { a1, a2, a3, a4, a5 });
- }
-
- public static Variant call(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6) {
- return callN(disp, dispid, new Object[] { a1, a2, a3, a4, a5, a6 });
- }
-
- public static Variant call(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6, Object a7) {
- return callN(disp, dispid, new Object[] { a1, a2, a3, a4, a5, a6, a7 });
- }
-
- public static Variant call(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) {
- return callN(disp, dispid, new Object[] { a1, a2, a3, a4, a5, a6, a7,
- a8 });
- }
-
- public static void put(Object disp, String name, Object val) {
- invoke(disp, name, Put, new Object[] { val }, new int[1]);
- }
-
- public static void put(Object disp, int dispid, Object val) {
- invoke(disp, dispid, Put, new Object[] { val }, new int[1]);
- }
-
- // removed _Guid argument
- public static native Variant invokev(Object disp, String name, int dispID,
- int lcid, int wFlags, Variant[] vArg, int[] uArgErr);
-
- public static Variant invokev(Object disp, String name, int wFlags,
- Variant[] vArg, int[] uArgErr) {
- if (!(disp instanceof Dispatch))
- throw new ClassCastException("Dispatch object expected");
- return invokev(disp, name, 0, LOCALE_SYSTEM_DEFAULT, wFlags, vArg,
- uArgErr);
- }
-
- public static Variant invokev(Object disp, String name, int wFlags,
- Variant[] vArg, int[] uArgErr, int wFlagsEx) {
- if (!(disp instanceof Dispatch))
- throw new ClassCastException("Dispatch object expected");
- // do not implement IDispatchEx for now
- return invokev(disp, name, 0, LOCALE_SYSTEM_DEFAULT, wFlags, vArg,
- uArgErr);
- }
-
- public static Variant invokev(Object disp, int dispID, int wFlags,
- Variant[] vArg, int[] uArgErr) {
- if (!(disp instanceof Dispatch))
- throw new ClassCastException("Dispatch object expected");
- return invokev(disp, null, dispID, LOCALE_SYSTEM_DEFAULT, wFlags, vArg,
- uArgErr);
- }
-
- // removed _Guid argument
- public static void invokeSub(Object disp, String name, int dispid,
- int lcid, int wFlags, Object[] oArg, int[] uArgErr) {
- invokeSubv(disp, name, dispid, lcid, wFlags, obj2variant(oArg), uArgErr);
- }
-
- public static void invokeSub(Object disp, String name, int wFlags,
- Object[] oArg, int[] uArgErr) {
- invokeSub(disp, name, 0, LOCALE_SYSTEM_DEFAULT, wFlags, oArg, uArgErr);
- }
-
- public static void invokeSub(Object disp, int dispid, int wFlags,
- Object[] oArg, int[] uArgErr) {
- invokeSub(disp, null, dispid, LOCALE_SYSTEM_DEFAULT, wFlags, oArg,
- uArgErr);
- }
-
- public static void callSub(Object disp, String name) {
- callSubN(disp, name, new Object[0]);
- }
-
- public static void callSub(Object disp, String name, Object a1) {
- callSubN(disp, name, new Object[] { a1 });
- }
-
- public static void callSub(Object disp, String name, Object a1, Object a2) {
- callSubN(disp, name, new Object[] { a1, a2 });
- }
-
- public static void callSub(Object disp, String name, Object a1, Object a2,
- Object a3) {
- callSubN(disp, name, new Object[] { a1, a2, a3 });
- }
-
- public static void callSub(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4) {
- callSubN(disp, name, new Object[] { a1, a2, a3, a4 });
- }
-
- public static void callSub(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4, Object a5) {
- callSubN(disp, name, new Object[] { a1, a2, a3, a4, a5 });
- }
-
- public static void callSub(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6) {
- callSubN(disp, name, new Object[] { a1, a2, a3, a4, a5, a6 });
- }
-
- public static void callSub(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6, Object a7) {
- callSubN(disp, name, new Object[] { a1, a2, a3, a4, a5, a6, a7 });
- }
-
- public static void callSub(Object disp, String name, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) {
- callSubN(disp, name, new Object[] { a1, a2, a3, a4, a5, a6, a7, a8 });
- }
-
- public static void callSub(Object disp, int dispid) {
- callSubN(disp, dispid, new Object[0]);
- }
-
- public static void callSub(Object disp, int dispid, Object a1) {
- callSubN(disp, dispid, new Object[] { a1 });
- }
-
- public static void callSub(Object disp, int dispid, Object a1, Object a2) {
- callSubN(disp, dispid, new Object[] { a1, a2 });
- }
-
- public static void callSub(Object disp, int dispid, Object a1, Object a2,
- Object a3) {
- callSubN(disp, dispid, new Object[] { a1, a2, a3 });
- }
-
- public static void callSub(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4) {
- callSubN(disp, dispid, new Object[] { a1, a2, a3, a4 });
- }
-
- public static void callSub(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4, Object a5) {
- callSubN(disp, dispid, new Object[] { a1, a2, a3, a4, a5 });
- }
-
- public static void callSub(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6) {
- callSubN(disp, dispid, new Object[] { a1, a2, a3, a4, a5, a6 });
- }
-
- public static void callSub(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6, Object a7) {
- callSubN(disp, dispid, new Object[] { a1, a2, a3, a4, a5, a6, a7 });
- }
-
- public static void callSub(Object disp, int dispid, Object a1, Object a2,
- Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) {
- callSubN(disp, dispid, new Object[] { a1, a2, a3, a4, a5, a6, a7, a8 });
- }
-
- public static Variant get(Object disp, String name) {
- return invokev(disp, name, Get, new Variant[0], new int[0]);
- }
-
- public static Variant get(Object disp, int dispid) {
- return invokev(disp, dispid, Get, new Variant[0], new int[0]);
- }
-
- public static void putRef(Object disp, String name, Object val) {
- invoke(disp, name, PutRef, new Object[] { val }, new int[1]);
- }
-
- public static void putRef(Object disp, int dispid, Object val) {
- invoke(disp, dispid, PutRef, new Object[] { val }, new int[1]);
- }
-
- public static Variant get_CaseSensitive(Object disp, String name) {
- throw new ClassCastException("not implemented yet");
- }
-
- static {
- System.loadLibrary("jacob");
- }
-
- protected void finalize() {
- //System.out.println("Dispatch finalize start");
- if (m_pDispatch != 0)
- release();
- //System.out.println("Dispatch finalize end");
- }
-}
\ No newline at end of file
diff --git a/com/jacob/com/DispatchEvents.java b/com/jacob/com/DispatchEvents.java
deleted file mode 100644
index ba49e9e..0000000
--- a/com/jacob/com/DispatchEvents.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1999-2004 Sourceforge JACOB Project.
- * All rights reserved. Originator: Dan Adler (http://danadler.com).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Redistributions in any form must be accompanied by information on
- * how to obtain complete source code for the JACOB software.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jacob.com;
-
-/**
- * ???
- */
-public class DispatchEvents extends JacobObject {
- int m_pConnPtProxy = 0;
-
- /**
- * @param src
- * @param sink
- */
- public DispatchEvents(Dispatch src, Object sink) {
- init(src, sink);
- }
-
- /**
- * @param src
- * @param sink
- * @param progId
- */
- public DispatchEvents(Dispatch src, Object sink, String progId) {
- init2(src, sink, progId);
- }
-
- // hook up a connection point proxy object
- // event methods on the sink object will be called
- // by name with a signature of (Variant[] args)
- protected native void init(Dispatch src, Object sink);
-
- protected native void init2(Dispatch src, Object sink, String progId);
-
- // call this to explicitly release the com object before gc
- public native void release();
-
- protected void finalize() {
- //System.out.println("DispatchEvents finalize start");
- if (m_pConnPtProxy != 0)
- release();
- //System.out.println("DispatchEvents finalize end");
- }
-
- static {
- System.loadLibrary("jacob");
- }
-}
\ No newline at end of file
diff --git a/com/jacob/com/JacobObject.java b/com/jacob/com/JacobObject.java
deleted file mode 100644
index 51dffe9..0000000
--- a/com/jacob/com/JacobObject.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1999-2004 Sourceforge JACOB Project.
- * All rights reserved. Originator: Dan Adler (http://danadler.com).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Redistributions in any form must be accompanied by information on
- * how to obtain complete source code for the JACOB software.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jacob.com;
-
-/**
- * All COM object created by JACOB extend this class so that we can
- * automatically release them when the thread is detached from COM - if we leave
- * it to the finalizer it will call the release from another thread, which may
- * result in a segmentation violation.
- */
-public class JacobObject {
- /**
- * Standard constructor
- */
- public JacobObject() {
- ROT.addObject(this);
- }
-
- /**
- *
- */
- public void release() {
- // currently does nothing
- }
-}
\ No newline at end of file
diff --git a/com/jacob/com/ROT.java b/com/jacob/com/ROT.java
deleted file mode 100644
index e706219..0000000
--- a/com/jacob/com/ROT.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1999-2004 Sourceforge JACOB Project.
- * All rights reserved. Originator: Dan Adler (http://danadler.com).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Redistributions in any form must be accompanied by information on
- * how to obtain complete source code for the JACOB software.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jacob.com;
-
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * The Running Object Table (ROT) maps each thread to a vector of all the
- * JacobObjects that were created in that thread. It always operates on the
- * current thread so all the methods are static and they implicitly get the
- * current thread. Conceptually, this is similar to the ThreadLocal class of
- * Java 1.2 but we are also supporting Java 1.6 The clearObjects method is used
- * to release all the COM objects created by Jacob in the current thread prior
- * to uninitializing COM for that thread. If we leave this job to the garbage
- * collector, then finalize might get called from a separate thread which is not
- * initialized for COM, and also the component itself may have been freed.
- */
-public abstract class ROT {
- private static Hashtable rot = new Hashtable();
-
- protected static void addThread() {
- String t_name = Thread.currentThread().getName();
- if (rot.contains(t_name))
- return;
- Vector v = new Vector();
- rot.put(t_name, v);
- }
-
- protected static void clearObjects() {
- String t_name = Thread.currentThread().getName();
- Vector v = (Vector) rot.get(t_name);
- if (v != null) {
- while (!v.isEmpty()) {
- JacobObject o = (JacobObject) v.elementAt(0);
- //System.out.println(t_name + "
- // release:"+o+"->"+o.getClass().getName());
- if (o != null)
- o.release();
- v.removeElementAt(0);
- }
- rot.remove(t_name);
- }
- }
-
- protected static void addObject(JacobObject o) {
- String t_name = Thread.currentThread().getName();
- //System.out.println(t_name + " add:"+o+"->"+o.getClass().getName());
- Vector v = (Vector) rot.get(t_name);
- if (v == null) {
- // this thread has not been initialized as a COM thread
- // so make it part of MTA for backwards compatibility
- ComThread.InitMTA(false);
- addThread();
- v = (Vector) rot.get(t_name);
- }
- if (v != null) {
- v.addElement(o);
- }
- }
-
- static {
- System.loadLibrary("jacob");
- }
-}
\ No newline at end of file
diff --git a/com/jacob/com/Variant.java b/com/jacob/com/Variant.java
deleted file mode 100644
index 644e4a4..0000000
--- a/com/jacob/com/Variant.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Copyright (c) 1999-2004 Sourceforge JACOB Project.
- * All rights reserved. Originator: Dan Adler (http://danadler.com).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Redistributions in any form must be accompanied by information on
- * how to obtain complete source code for the JACOB software.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jacob.com;
-
-/**
- * The multi-format data type used for all call backs and most
- * communications between Java and COM
- */
-public class Variant extends JacobObject implements java.io.Serializable
-{
- int m_pVariant = 0;
-
- public static final short VariantEmpty = 0;
- public static final short VariantNull = 1;
- public static final short VariantShort = 2;
- public static final short VariantInt = 3;
- public static final short VariantFloat = 4;
- public static final short VariantDouble = 5;
- public static final short VariantCurrency = 6;
- public static final short VariantDate = 7;
- public static final short VariantString = 8;
- public static final short VariantDispatch = 9;
- public static final short VariantError = 10;
- public static final short VariantBoolean = 11;
- public static final short VariantVariant = 12;
- public static final short VariantObject = 13;
- public static final short VariantByte = 17;
- public static final short VariantTypeMask = 4095;
- public static final short VariantArray = 8192;
- public static final short VariantByref = 16384;
-
- public native int toInt();
- public native double toDate();
- public native boolean toBoolean();
- public native EnumVariant toEnumVariant();
-
- public native void getNull();
- public native void putNull();
-
- public native Variant cloneIndirect();
- public native double toDouble();
- public native long toCurrency();
-
- // superceded by SafeArray
- public void putVariantArray(Variant[] in)
- {
- throw new ComFailException("Not implemented");
- }
-
- // superceded by SafeArray
- public Variant[] getVariantArray()
- {
- throw new ComFailException("Not implemented");
- }
-
- // superceded by SafeArray
- public void putByteArray(Object in)
- {
- throw new ComFailException("Not implemented");
- }
-
- public native void putShortRef(short in);
- public native void putIntRef(int in);
- public native void putDoubleRef(double in);
- public native void putDateRef(double in);
- public native void putStringRef(String in);
- public native short getShortRef();
- public native int getIntRef();
- public native void putShort(short in);
- public native short getShort();
- public native double getDoubleRef();
- public native double getDateRef();
- public native String getStringRef();
-
- // superceded by SafeArray
- public Object toCharArray()
- {
- throw new ComFailException("Not implemented");
- }
-
- public native void VariantClear();
- public native Dispatch toDispatch();
- public native Object clone();
- public native String toString();
- public native int getInt();
- public native double getDate();
- public native void putInt(int in);
- public native void putDate(double in);
- public native byte toByte();
-
- public Object getDispatch() { return toDispatch(); }
- public void putDispatch(Object in) { putObject(in); }
-
- public native boolean getBoolean();
- public native byte getByte();
- public native void putBoolean(boolean in);
- public native void putByte(byte in);
- public native int toError();
-
- public Object toObject()
- {
- return toDispatch();
- }
-
- public native void getEmpty();
- public native void putEmpty();
- public native int getError();
- public native void putError(int in);
- public native double getDouble();
- public Object getObject()
- {
- return toDispatch();
- }
-
- public native void putCurrency(long in);
-
- public native void putObject(Object in);
-
- public native void putDouble(double in);
- public native long getCurrency();
- public native void putFloatRef(float in);
- public native void putCurrencyRef(long in);
- public native void putErrorRef(int in);
- public native void putBooleanRef(boolean in);
-
- public void putObjectRef(Object in)
- {
- putObject(in);
- }
-
- public native void putByteRef(byte in);
- public native String getString();
- public native void putString(String in);
- public native float getFloatRef();
- public native long getCurrencyRef();
- public native int getErrorRef();
- public native boolean getBooleanRef();
- public native Object getObjectRef();
- public native byte getByteRef();
- public native float toFloat();
-
- /**
- * By default toSafeArray makes a deep copy due to the fact
- * that this Variant owns the embedded SafeArray and will
- * destroy it when it gc's
- */
- public SafeArray toSafeArray()
- {
- return toSafeArray(true);
- }
-
- public native SafeArray toSafeArray(boolean deepCopy);
- public native void putSafeArrayRef(SafeArray in);
- public native void putSafeArray(SafeArray in);
-
- public native void noParam();
-
- // superceded by SafeArray
- public void putCharArray(Object in)
- {
- throw new ComFailException("Not implemented");
- }
-
- public native float getFloat();
- public native void putFloat(float in);
-
- public void putDispatchRef(Object in) { putDispatch(in); }
- public Object getDispatchRef() { return getDispatch(); }
-
- // superceded by SafeArray
- public void putVariantArrayRef(Variant[] in)
- {
- throw new ClassCastException("Not implemented");
- }
-
- // superceded by SafeArray
- public Variant[] getVariantArrayRef()
- {
- throw new ClassCastException("Not implemented");
- }
-
- public native void changeType(short in);
-
- public void changeType(int in)
- {
- changeType((short)in);
- }
-
- public Object toScriptObject() { return toDispatch(); }
-
- public Variant()
- {
- init();
- putEmpty();
- }
-
- public Variant(int in)
- {
- init();
- putInt(in);
- }
-
- public Variant(double in)
- {
- init();
- putDouble(in);
- }
-
- public Variant(boolean in)
- {
- init();
- putBoolean(in);
- }
-
- public Variant(String in)
- {
- init();
- putString(in);
- }
-
- public Variant(SafeArray in,boolean fByRef)
- {
- init();
- if (fByRef) {
- putSafeArrayRef(in);
- } else {
- putSafeArray(in);
- }
- }
-
- public Variant(Object in)
- {
- this(in, false);
- }
-
- public Variant(Object o,boolean fByRef)
- {
- init();
- if (o == null) {
- putEmpty();
- } else if (o instanceof Integer) {
- if (fByRef) putIntRef(((Integer)o).intValue());
- else putInt(((Integer)o).intValue());
- } else if (o instanceof String) {
- if (fByRef) putStringRef((String)o);
- else putString((String)o);
- } else if (o instanceof Boolean) {
- if (fByRef) putBooleanRef(((Boolean)o).booleanValue());
- else putBoolean(((Boolean)o).booleanValue());
- } else if (o instanceof Double) {
- if (fByRef) putDoubleRef(((Double)o).doubleValue());
- else putDouble(((Double)o).doubleValue());
- } else if (o instanceof Float) {
- if (fByRef) putFloatRef(((Float)o).floatValue());
- else putFloat(((Float)o).floatValue());
- } else if (o instanceof SafeArray) {
- if (fByRef) putSafeArrayRef((SafeArray)o);
- else putSafeArray((SafeArray)o);
- } else {
- if (fByRef) putObjectRef(o); else putObject(o);
- }
- }
-
- //weird constructors
- public Variant(int in,int in1)
- {
- throw new ComFailException("Not implemented");
- }
-
- public Variant(int in,boolean in1)
- {
- throw new ComFailException("Not implemented");
- }
-
- public Variant(int in,double in1)
- {
- throw new ComFailException("Not implemented");
- }
-
- public Variant(int in,Object in1)
- {
- throw new ComFailException("Not implemented");
- }
-
- public native short getvt();
- public native short toShort();
-
- // call this to explicitly release the com object before gc
- public native void release();
-
- protected native void init();
-
- protected void finalize()
- {
- //System.out.println("Variant finalize start:"+m_pVariant);
- if (m_pVariant != 0) release();
- //System.out.println("Variant finalize end");
- }
-
-
- // superceded by SafeArray
- public Variant[] toVariantArray()
- {
- throw new ClassCastException("Not implemented");
- }
-
- // superceded by SafeArray
- public Object toByteArray()
- {
- throw new ClassCastException("Not implemented");
- }
-
- static {
- System.loadLibrary("jacob");
- }
-
- // serialization support
- private void writeObject(java.io.ObjectOutputStream oos)
- {
- try {
- Save(oos);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void readObject(java.io.ObjectInputStream ois)
- {
- try {
- Load(ois);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- // is the variant null or empty or error or null disp
- public native boolean isNull();
-
- public native void Save(java.io.OutputStream os)
- throws java.io.IOException;
-
- public native void Load(java.io.InputStream is)
- throws java.io.IOException;
-
-}
diff --git a/EventCallbacks.htm b/docs/EventCallbacks.htm
similarity index 71%
rename from EventCallbacks.htm
rename to docs/EventCallbacks.htm
index 4859158..078a589 100644
--- a/EventCallbacks.htm
+++ b/docs/EventCallbacks.htm
@@ -7,7 +7,7 @@ xmlns="http://www.w3.org/TR/REC-html40">
-
+
Jacob can register Java classes for MS application events or callbacks
VARIANT(a) |
+ +-----------+ | VT_ARRAY| +---------+
+ | parray---->SAFEARRAY|
+ +------------+ +^--------+
+ |
+ +-----------+ |
+ |Variant | +------------+ |
+ | m_pVariant--->VARIANT(b) | |
+ +-----------+ | VT_ARRAY| |
+ | parray-----+
+ +------------+
+
+ When previous objects are rereased by
+ ComThread.Release(),
+ first the VARIANT(a) is released by VariantClear()
+ function,
+ and second the VARIANT(b) is released by VariantClear()
+ function too.
+ But the SAFEARRAY was already released by the
+ VARIANT(a).
+
+ So, in my enviroment (WinXP + J2SDK 1.4.1) the
+ following java program
+ is sometimes crash with EXCEPTION_ACCESS_VIOLATION.
+
+
+ To solve this problem, it is nessesary to copy the
+ SAFEARRAY like this:
+
+ +-----------+
+ |Variant | +------------+
+ | m_pVariant--->VARIANT(a) |
+ +-----------+ | VT_ARRAY| +---------+
+ | parray---->SAFEARRAY|
+ +------------+ +|--------+
+ |
+ +-----------+ | copySA()
+ |SafeArray | +------------+ |
+ | m_pV--->VARIANT(b) | V
+ +-----------+ | VT_ARRAY| +---------+
+ | parray---->SAFEARRAY|
+ +------------+ +---------+
+ */
+
+public class SafeArrayReleaseTest
+{
+ final static int MAX = 300;
+ public static void main(String[] args)
+ {
+ int count;
+ System.out.println("Starting test for max = "+MAX);
+ for(count = 1; count