Ejemplo n.º 1
0
  private int QueryContinueDrag(int fEscapePressed, int grfKeyState) {
    if (topControl != null && topControl.isDisposed()) return COM.DRAGDROP_S_CANCEL;
    if (fEscapePressed != 0) {
      if (hwndDrag != 0) OS.ImageList_DragLeave(hwndDrag);
      return COM.DRAGDROP_S_CANCEL;
    }
    /*
     * Bug in Windows.  On some machines that do not have XBUTTONs,
     * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set,
     * causing mouse capture to become stuck.  The fix is to test
     * for the extra buttons only when they exist.
     */
    int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON;
    //	if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
    if ((grfKeyState & mask) == 0) {
      if (hwndDrag != 0) OS.ImageList_DragLeave(hwndDrag);
      return COM.DRAGDROP_S_DROP;
    }

    if (hwndDrag != 0) {
      POINT pt = new POINT();
      OS.GetCursorPos(pt);
      RECT rect = new RECT();
      OS.GetWindowRect(hwndDrag, rect);
      OS.ImageList_DragMove(pt.x - rect.left, pt.y - rect.top);
    }
    return COM.S_OK;
  }