diff --git a/com/jacob/com/ComFailException.java b/com/jacob/com/ComFailException.java index bb3a415..80df53e 100644 --- a/com/jacob/com/ComFailException.java +++ b/com/jacob/com/ComFailException.java @@ -27,10 +27,7 @@ package com.jacob.com; /** - * @author joe - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * COM Fail Exception class raise dwhen there is a problem */ public class ComFailException extends ComException { /** diff --git a/com/jacob/com/ComThread.java b/com/jacob/com/ComThread.java index 976f40a..61d83d7 100644 --- a/com/jacob/com/ComThread.java +++ b/com/jacob/com/ComThread.java @@ -27,10 +27,7 @@ package com.jacob.com; /** - * @author joe - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * represents a COM level thread */ public abstract class ComThread { private static final int MTA = 0x0; diff --git a/com/jacob/com/Dispatch.java b/com/jacob/com/Dispatch.java index 2d351a8..554c827 100644 --- a/com/jacob/com/Dispatch.java +++ b/com/jacob/com/Dispatch.java @@ -1,546 +1,550 @@ -/* - * 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; - -public class Dispatch extends JacobObject -{ - public int m_pDispatch; - 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 - protected static Variant[] obj2variant(Object[] o) - { - Variant vArg[] = new Variant[o.length]; - for(int i=0;i