Package org.eclipse.swt.internal.ole.win32

Examples of org.eclipse.swt.internal.ole.win32.GUID


   * by hand.
   */
  private static int[] oleAutomationGetIdsOfNames(IDispatch dispatch) {
    String[] names = new String[] {"valueOf"};
    int[] ids = new int[names.length];
    int result = dispatch.GetIDsOfNames(new GUID(), names, names.length,
        COM.LOCALE_USER_DEFAULT, ids);
    if (result != COM.S_OK) {
      return null;
    }
    return ids;
View Full Code Here


    int pVarResultAddress = 0;
    try {
      pVarResultAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT,
          Variant.sizeof);
      int[] pArgErr = new int[1];
      int hr = dispatch.Invoke(dispId, new GUID(), COM.LOCALE_USER_DEFAULT,
          COM.DISPATCH_METHOD, new DISPPARAMS(), pVarResultAddress,
          new EXCEPINFO(), pArgErr);

      if (hr >= COM.S_OK) {
        return Variant.win32_new(pVarResultAddress);
View Full Code Here

   * by hand.
   */
  private static int[] oleAutomationGetIdsOfNames(IDispatch dispatch) {
    String[] names = new String[] {"valueOf"};
    int[] ids = new int[names.length];
    int result = dispatch.GetIDsOfNames(new GUID(), names, names.length,
        COM.LOCALE_USER_DEFAULT, ids);
    if (result != COM.S_OK) {
      return null;
    }
    return ids;
View Full Code Here

    int pVarResultAddress = 0;
    try {
      pVarResultAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT,
          Variant.sizeof);
      int[] pArgErr = new int[1];
      int hr = dispatch.Invoke(dispId, new GUID(), COM.LOCALE_USER_DEFAULT,
          COM.DISPATCH_METHOD, new DISPPARAMS(), pVarResultAddress,
          new EXCEPINFO(), pArgErr);

      if (hr >= COM.S_OK) {
        return Utils.win32_new(pVarResultAddress);
View Full Code Here

  // CHECKSTYLE_OFF
  public int QueryInterface(int riid, int ppvObject) {
    if (riid == 0 || ppvObject == 0) {
      return COM.E_NOINTERFACE;
    }
    GUID guid = new GUID();
    COM.MoveMemory(guid, riid, GUID.sizeof);

    if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
      OS.MoveMemory(ppvObject, new int[] {getAddress()}, 4);
      AddRef();
View Full Code Here

                (IDispatchImpl) WrappersCache.getWrapperForObject(classLoader, obj);
            if (dispMethod == null || dispMethod.refCount < 1) {
              dispMethod = new MethodDispatch(classLoader, dispIdOracle, method);
              WrappersCache.putWrapperForObject(classLoader, obj, dispMethod);
            }
            IDispatch disp = new IDispatch(dispMethod.getAddress());
            disp.AddRef();
            return new Variant(disp);
          }
        } else if (javaDispatch.isField(dispId)) {
          Field field = javaDispatch.getField(dispId);
          if (flags == COM.DISPATCH_PROPERTYGET) {
View Full Code Here

              (IDispatchImpl) WrappersCache.getWrapperForObject(classLoader, obj);
          if (dispMethod == null || dispMethod.refCount < 1) {
            dispMethod = new MethodDispatch(classLoader, dispIdOracle, toStringMethod);
            WrappersCache.putWrapperForObject(classLoader, obj, dispMethod);
          }
          IDispatch disp = new IDispatch(dispMethod.getAddress());
          disp.AddRef();
          return new Variant(disp);
        }
        break;
      case 2 :
        // call
View Full Code Here

        // MAGIC: this is the default property, let's just do toString()
        return new Variant(toString());
      } else if (dispId == 1) {
        if ((flags & COM.DISPATCH_METHOD) != 0) {
          try {
            IDispatch frameWnd =
                params[0].getType() == COM.VT_DISPATCH ? params[0].getDispatch() : null;
            boolean success = gwtOnLoad(frameWnd);
            // boolean return type
            return new Variant(success);
          } catch (SWTException e) {
            throw new HResultException(COM.E_INVALIDARG);
          }
        } else if ((flags & COM.DISPATCH_PROPERTYGET) != 0) {
          // property get on the method itself
          try {
            IDispatchImpl funcObj = new IDispatchImpl() {
              // do nothing, just return some IDispatch
              @Override
              protected Variant invoke(int dispId, int flags, Variant[] params)
                  throws HResultException, InstantiationException, InvocationTargetException {
                return new Variant();
              }

              @Override
              protected void getIDsOfNames(String[] names, int[] ids) throws HResultException {
              }
            };
            IDispatch disp = new IDispatch(funcObj.getAddress());
            disp.AddRef();
            return new Variant(disp);
          } catch (Exception e) {
            // just return VT_EMPTY
            return new Variant();
          }
View Full Code Here

      int dispIdMember,
      int wFlags,
      Variant[] rgvarg,
      int[] rgdispidNamedArgs,
      Variant pVarResult) throws Exception {
    IDispatch objIDispatch = (IDispatch) ReflectionUtils.getFieldObject(automation, "objIDispatch");
    // get the IDispatch interface for the control
    if (objIDispatch == null)
      return COM.E_FAIL;
    // create a DISPPARAMS structure for the input parameters
    DISPPARAMS pDispParams = new DISPPARAMS();
    // store arguments in rgvarg
    if (rgvarg != null && rgvarg.length > 0) {
      pDispParams.cArgs = rgvarg.length;
      pDispParams.rgvarg =
          OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, VARIANT.sizeof * rgvarg.length);
      int offset = 0;
      for (int i = rgvarg.length - 1; i >= 0; i--) {
        ReflectionUtils.invokeMethod(rgvarg[i], "getData(int)", pDispParams.rgvarg + offset);
        offset += VARIANT.sizeof;
      }
    }
    // if arguments have ids, store the ids in rgdispidNamedArgs
    if (rgdispidNamedArgs != null && rgdispidNamedArgs.length > 0) {
      pDispParams.cNamedArgs = rgdispidNamedArgs.length;
      pDispParams.rgdispidNamedArgs =
          OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4 * rgdispidNamedArgs.length);
      int offset = 0;
      for (int i = rgdispidNamedArgs.length; i > 0; i--) {
        COM.MoveMemory(
            pDispParams.rgdispidNamedArgs + offset,
            new int[]{rgdispidNamedArgs[i - 1]},
            4);
        offset += 4;
      }
    }
    // invoke the method
    EXCEPINFO excepInfo = new EXCEPINFO();
    int[] pArgErr = new int[1];
    int /*long*/pVarResultAddress = 0;
    if (pVarResult != null)
      pVarResultAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, VARIANT.sizeof);
    int result =
        objIDispatch.Invoke(
            dispIdMember,
            new GUID(),
            COM.LOCALE_USER_DEFAULT,
            wFlags,
            pDispParams,
View Full Code Here

    if (variant == null) {
      return new Variant();
    }
    switch (variant.getType()) {
      case COM.VT_DISPATCH : {
        IDispatch dispatch = variant.getDispatch();
        dispatch.AddRef();
        return new Variant(dispatch);
      }
      case COM.VT_UNKNOWN : {
        IUnknown unknown = variant.getUnknown();
        unknown.AddRef();
View Full Code Here

TOP

Related Classes of org.eclipse.swt.internal.ole.win32.GUID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.