Package com.sun.jna.ptr

Examples of com.sun.jna.ptr.NativeLongByReference


          errors.verifyErrorCode(result, "Cannot extract string result");
          toReturn = new StringWrapper(lib, wrapper).toString();
          break;

        case IeReturnTypes.LONG: // Long
          NativeLongByReference value = new NativeLongByReference();
          result = lib.wdGetNumberScriptResult(scriptResult, value);
          errors.verifyErrorCode(result, "Cannot extract number result");
          toReturn = value.getValue().longValue();
          break;

        case IeReturnTypes.BOOLEAN: // Boolean
          IntByReference boolVal = new IntByReference();
          result = lib.wdGetBooleanScriptResult(scriptResult, boolVal);
View Full Code Here


    errors.verifyErrorCode(result, "select");
  }

  public void hover() {
    HWNDByReference hwnd = new HWNDByReference();
    NativeLongByReference x = new NativeLongByReference();
    NativeLongByReference y = new NativeLongByReference();
    NativeLongByReference width = new NativeLongByReference();
    NativeLongByReference height = new NativeLongByReference();
    int result = lib.wdeGetDetailsOnceScrolledOnToScreen(element, hwnd, x, y, width, height);

    errors.verifyErrorCode(result, "hover");

    long midX = x.getValue().longValue() + (width.getValue().longValue() / 2);
    long midY = y.getValue().longValue() + (height.getValue().longValue() / 2);

    result = lib.wdeMouseMoveTo(hwnd.getValue(), new NativeLong(100),
                                new NativeLong(0), new NativeLong(0),
                                new NativeLong(midX), new NativeLong(midY));
View Full Code Here

    return displayed.getValue() == 1;
  }

  public Point getLocationOnScreenOnceScrolledIntoView() {
    HWNDByReference hwnd = new HWNDByReference();
    NativeLongByReference x = new NativeLongByReference();
    NativeLongByReference y = new NativeLongByReference();
    NativeLongByReference width = new NativeLongByReference();
    NativeLongByReference height = new NativeLongByReference();
    if (lib.wdeGetDetailsOnceScrolledOnToScreen(element, hwnd, x, y, width, height) != 0) {
      return null;
    }

    return new Point(x.getValue().intValue(), y.getValue().intValue());
View Full Code Here

    return new Point(x.getValue().intValue(), y.getValue().intValue());
  }

  public Point getLocation() {
    NativeLongByReference x = new NativeLongByReference();
    NativeLongByReference y = new NativeLongByReference();

    int result = lib.wdeGetLocation(element, x, y);
    errors.verifyErrorCode(result, "Unable to get location of element");

    return new Point(x.getValue().intValue(), y.getValue().intValue());
  }
View Full Code Here

    return new Point(x.getValue().intValue(), y.getValue().intValue());
  }

  public Dimension getSize() {
    NativeLongByReference width = new NativeLongByReference();
    NativeLongByReference height = new NativeLongByReference();
    int result = lib.wdeGetSize(element, width, height);

    errors.verifyErrorCode(result, "Unable to get element size");

    return new Dimension(width.getValue().intValue(), height.getValue().intValue());
  }
View Full Code Here

    lib.wdeFreeElement(element);
  }

  public void dragAndDropBy(int moveRightBy, int moveDownBy) {
    HWNDByReference hwnd = new HWNDByReference();
    NativeLongByReference x = new NativeLongByReference();
    NativeLongByReference y = new NativeLongByReference();
    NativeLongByReference width = new NativeLongByReference();
    NativeLongByReference height = new NativeLongByReference();
    int result = lib.wdeGetDetailsOnceScrolledOnToScreen(element, hwnd, x, y, width, height);
    errors.verifyErrorCode(result, "Unable to determine location once scrolled on to screen");

    lib.wdeMouseDownAt(hwnd.getValue(), x.getValue(), y.getValue());
View Full Code Here

    lib.wdeMouseUpAt(hwnd.getValue(), new NativeLong(endX), new NativeLong(endY));
  }

  public void dragAndDropOn(RenderedWebElement toElement) {
    HWNDByReference hwnd = new HWNDByReference();
    NativeLongByReference x = new NativeLongByReference();
    NativeLongByReference y = new NativeLongByReference();
    NativeLongByReference width = new NativeLongByReference();
    NativeLongByReference height = new NativeLongByReference();
    int result = lib.wdeGetDetailsOnceScrolledOnToScreen(element, hwnd, x, y, width, height);
    errors.verifyErrorCode(result, "Unable to determine location once scrolled on to screen");

    NativeLong
        startX =
        new NativeLong(x.getValue().longValue() + (width.getValue().longValue() / 2));
    NativeLong
        startY =
        new NativeLong(y.getValue().longValue() + (height.getValue().longValue() / 2));

    lib.wdeMouseDownAt(hwnd.getValue(), startX, startY);

    Pointer other = ((InternetExplorerElement) toElement).element;
    result = lib.wdeGetDetailsOnceScrolledOnToScreen(other, hwnd, x, y, width, height);
    errors.verifyErrorCode(result,
                           "Unable to determine location of target once scrolled on to screen");

    NativeLong endX = new NativeLong(x.getValue().longValue() + (width.getValue().longValue() / 2));
    NativeLong
        endY =
        new NativeLong(y.getValue().longValue() + (height.getValue().longValue() / 2));

    int duration = parent.manage().getSpeed().getTimeOut();
    lib.wdeMouseMoveTo(hwnd.getValue(), new NativeLong(duration), startX, startY, endX, endY);
    lib.wdeMouseUpAt(hwnd.getValue(), endX, endY);
  }
View Full Code Here

                CFDictionaryRef dictionaryRef = new CFDictionaryRef(pointer);

                // Determine the process ID of this window
                NSString kCGWindowOwnerPID = CoreGraphicsLibrary.kCGWindowOwnerPID;
                Pointer pidPointer = CoreFoundationLibrary.INSTANCE.CFDictionaryGetValue(dictionaryRef, kCGWindowOwnerPID.id());
                NativeLongByReference longByReference = new NativeLongByReference();
                CoreFoundationLibrary.INSTANCE.CFNumberGetValue(pidPointer, CoreFoundationLibrary.CFNumberType.kCFNumberLongType, longByReference.getPointer());
                long pidLong = longByReference.getValue().longValue();

                if (pidLong == pid) {
                    // This window is a Hearthstone window

                    // When running in full-screen mode, Hearthstone has two windows: one for the game and one that appears to be a temporary desktop or space for the game to run in.
View Full Code Here

    }

    @Test
    public void testDifftime() throws Exception {
        // Pointer to hold the times
        NativeLongByReference ref = new NativeLongByReference();

        // time() returns -1 on error.
        NativeLong err = new NativeLong(-1L);

        LibC.time(ref);
        NativeLong time0 = ref.getValue();
        Assert.assertNotSame(time0, err, "Time 0 returned an error (-1).");

        Thread.sleep(5000L);

        LibC.time(ref);
        NativeLong time1 = ref.getValue();
        Assert.assertNotSame(time1, err, "Time 1 returned an error (-1).");

        Assert.assertNotSame(time1, time0, "Time 1 returned same time as Time 0.");

        double diff = LibC.difftime(time1, time0);
View Full Code Here

    if(agent.start(null, false))
    {
      for(int i = 0; i < sockets; i++)
      {
        NativeLongByReference pdwConnID = new NativeLongByReference();
        if(agent.connect(serverAddr, port, pdwConnID))
        {
          connIDs.add(pdwConnID.getValue());
          if(i == sockets - 1)
            isOK = true;
        }
        else
        {
View Full Code Here

TOP

Related Classes of com.sun.jna.ptr.NativeLongByReference

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.