Package com.sun.jna.platform.win32

Examples of com.sun.jna.platform.win32.OaIdl$EXCEPINFO$ByReference


    if (W32Errors.SUCCEEDED(hr.intValue()))
      Ole32.INSTANCE.CoUninitialize();
  }

  public void testCoCreateInstance() {
    HRESULT hrCI = Ole32.INSTANCE.CoInitializeEx(null, 0);

    GUID guid = Ole32Util
        .getGUIDFromString("{00021401-0000-0000-C000-000000000046}"); // Shell object
    GUID riid = Ole32Util
        .getGUIDFromString("{000214EE-0000-0000-C000-000000000046}"); // IShellLinkA

    PointerByReference pDispatch = new PointerByReference();

    HRESULT hr = Ole32.INSTANCE.CoCreateInstance(guid, null, // pOuter =
                                  // null, no
                                  // aggregation
        WTypes.CLSCTX_LOCAL_SERVER, riid, pDispatch);
    assertTrue(W32Errors.SUCCEEDED(hr.intValue()));
    assertTrue(!pDispatch.equals(Pointer.NULL));
    // We leak this iUnknown reference because we don't have the JNACOM lib
    // here to wrap the native iUnknown pointer and call iUnknown.release()
    if (W32Errors.SUCCEEDED(hrCI.intValue()))
      Ole32.INSTANCE.CoUninitialize();
View Full Code Here


   * @return
   *  A GUID.
   */
  public static GUID getGUIDFromString(String guidString) {
    GUID lpiid = new GUID();
      HRESULT hr = Ole32.INSTANCE.IIDFromString(guidString, lpiid);
      if (! hr.equals(W32Errors.S_OK)) {
        throw new RuntimeException(hr.toString());
      }
      return lpiid;
  }
View Full Code Here

   * @return
   *  New GUID.
   */
  public static GUID generateGUID() {
    GUID pguid = new GUID();
      HRESULT hr = Ole32.INSTANCE.CoCreateGuid(pguid);
      if (! hr.equals(W32Errors.S_OK)) {
        throw new RuntimeException(hr.toString());
      }
      return pguid;
  }
View Full Code Here

                null, 1, null, 0, pcbNeeded, pcReturned);
        if (pcbNeeded.getValue() <= 0) {
            return new PRINTER_INFO_1[0];
        }

        PRINTER_INFO_1 pPrinterEnum = new PRINTER_INFO_1(pcbNeeded.getValue());
        if (!Winspool.INSTANCE.EnumPrinters(Winspool.PRINTER_ENUM_LOCAL,
                null, 1, pPrinterEnum.getPointer(), pcbNeeded.getValue(), pcbNeeded, pcReturned)) {
            throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
        }

        pPrinterEnum.read();

        return (PRINTER_INFO_1[]) pPrinterEnum.toArray(pcReturned.getValue());
    }
View Full Code Here

                null, 4, null, 0, pcbNeeded, pcReturned);
        if (pcbNeeded.getValue() <= 0) {
            return new PRINTER_INFO_4[0];
        }

        PRINTER_INFO_4 pPrinterEnum = new PRINTER_INFO_4(pcbNeeded.getValue());
        if (!Winspool.INSTANCE.EnumPrinters(Winspool.PRINTER_ENUM_LOCAL,
                null, 4, pPrinterEnum.getPointer(), pcbNeeded.getValue(), pcbNeeded, pcReturned)) {
            throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
        }

        pPrinterEnum.read();

        return (PRINTER_INFO_4[]) pPrinterEnum.toArray(pcReturned.getValue());
    }
View Full Code Here

            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 =
View Full Code Here

            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);
      }
    } finally {
View Full Code Here

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

      if (hr >= COM.S_OK) {
        result = Variant.win32_new(pVarResultAddress);
        globalRef = result.getInt();
      }
View Full Code Here

      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);
      }
    } finally {
View Full Code Here

      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);
      }
    } finally {
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.OaIdl$EXCEPINFO$ByReference

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.