?? comobject.java
字號:
/******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/package org.eclipse.swt.internal.ole.win32;import java.util.Hashtable;import org.eclipse.swt.internal.*;import org.eclipse.swt.internal.win32.*;public class COMObject { private int ppVtable; static private final int MAX_ARG_COUNT = 12; static private final int MAX_VTABLE_LENGTH = 80; static private Callback[][] Callbacks = new Callback[MAX_VTABLE_LENGTH][MAX_ARG_COUNT]; static private Hashtable ObjectMap = new Hashtable(); public COMObject(int[] argCounts) { int[] callbackAddresses = new int[argCounts.length]; for (int i = 0, length = argCounts.length; i < length; i++){ if ((Callbacks[i][argCounts[i]]) == null) { Callbacks[i][argCounts[i]] = new Callback(this.getClass(), "callback"+i, argCounts[i] + 1, true); //$NON-NLS-1$ } callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress(); } int pVtable = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4 * argCounts.length); COM.MoveMemory(pVtable, callbackAddresses, 4 * argCounts.length); ppVtable = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4); COM.MoveMemory(ppVtable, new int[] {pVtable}, 4); ObjectMap.put(new Integer(ppVtable), this);}public static GUID IIDFromString(String lpsz) { // create a null terminated array of char char[] buffer = (lpsz +"\0").toCharArray(); // invoke system method GUID lpiid = new GUID(); if (COM.IIDFromString(buffer, lpiid) == COM.S_OK) return lpiid; return null;}static int callback0(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method0(args);}static int callback1(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method1(args);}static int callback2(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method2(args);}static int callback3(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method3(args);}static int callback4(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method4(args);}static int callback5(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method5(args);}static int callback6(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method6(args);}static int callback7(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method7(args);}static int callback8(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method8(args);}static int callback9(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method9(args);}static int callback10(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method10(args);}static int callback11(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method11(args);}static int callback12(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method12(args);}static int callback13(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method13(args);}static int callback14(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method14(args);}static int callback15(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method15(args);}static int callback16(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method16(args);}static int callback17(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method17(args);}static int callback18(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method18(args);}static int callback19(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method19(args);}static int callback20(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method20(args);}static int callback21(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method21(args);}static int callback22(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method22(args);}static int callback23(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method23(args);}static int callback24(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method24(args);}static int callback25(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method25(args);}static int callback26(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method26(args);}static int callback27(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method27(args);}static int callback28(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method28(args);}static int callback29(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method29(args);}static int callback30(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method30(args);}static int callback31(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0]; Object object = ObjectMap.get(new Integer(address)); if (object == null) return COM.E_FAIL; int[] args = new int[callbackArgs.length - 1]; System.arraycopy(callbackArgs, 1, args, 0, args.length); return ((COMObject) object).method31(args);}static int callback32(int[] callbackArgs) { // find the object on which this call was invoked int address = callbackArgs[0];
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -