ret = 0;
int handle_prefslist(struct prefslist *hdl,                     int *array, int maxmemb,                     int is_dlmsg, HWND hwnd,		     WPARAM wParam, LPARAM lParam){    int i;    int ret;    if (is_dlmsg) {        if ((int)wParam == hdl->listid) {            DRAGLISTINFO *dlm = (DRAGLISTINFO *)lParam;            int dest;            switch (dlm->uNotification) {              case DL_BEGINDRAG:		hdl->dummyitem =		    SendDlgItemMessage(hwnd, hdl->listid,				       LB_ADDSTRING, 0, (LPARAM) "");                hdl->srcitem = LBItemFromPt(dlm->hWnd, dlm->ptCursor, TRUE);		hdl->dragging = 0;		/* XXX hack Q183115 */		SetWindowLong(hwnd, DWL_MSGRESULT, TRUE);                ret = 1; break;              case DL_CANCELDRAG:		DrawInsert(hwnd, dlm->hWnd, -1);     /* Clear arrow */		SendDlgItemMessage(hwnd, hdl->listid,				   LB_DELETESTRING, hdl->dummyitem, 0);		hdl->dragging = 0;                ret = 1; break;              case DL_DRAGGING:		hdl->dragging = 1;		dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, TRUE);		if (dest > hdl->dummyitem) dest = hdl->dummyitem;		DrawInsert (hwnd, dlm->hWnd, dest);		if (dest >= 0)		    SetWindowLong(hwnd, DWL_MSGRESULT, DL_MOVECURSOR);		else		    SetWindowLong(hwnd, DWL_MSGRESULT, DL_STOPCURSOR);                ret = 1; break;              case DL_DROPPED:		if (hdl->dragging) {		    dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, TRUE);		    if (dest > hdl->dummyitem) dest = hdl->dummyitem;		    DrawInsert (hwnd, dlm->hWnd, -1);		}		SendDlgItemMessage(hwnd, hdl->listid,				   LB_DELETESTRING, hdl->dummyitem, 0);		if (hdl->dragging) {		    hdl->dragging = 0;		    if (dest >= 0) {			/* Correct for "missing" item. */			if (dest > hdl->srcitem) dest--;			pl_moveitem(hwnd, hdl->listid, hdl->srcitem, dest);		    }		}                ret = 1; break;            }        }    } else {        ret = 0;        if (((LOWORD(wParam) == hdl->upbid) ||             (LOWORD(wParam) == hdl->dnbid)) &&            ((HIWORD(wParam) == BN_CLICKED) ||             (HIWORD(wParam) == BN_DOUBLECLICKED))) {            /* Move an item up or down the list. */            /* Get the current selection, if any. */            int selection = SendDlgItemMessage (hwnd, hdl->listid, LB_GETCURSEL, 0, 0);            if (selection == LB_ERR) {                MessageBeep(0);            } else {                int nitems;                /* Get the total number of items. */                nitems = SendDlgItemMessage (hwnd, hdl->listid, LB_GETCOUNT, 0, 0);                /* Should we do anything? */		if (LOWORD(wParam) == hdl->upbid && (selection > 0))		    pl_moveitem(hwnd, hdl->listid, selection, selection - 1);		else if (LOWORD(wParam) == hdl->dnbid && (selection < nitems - 1))		    pl_moveitem(hwnd, hdl->listid, selection, selection + 1);            }        }    }    /* Update array to match the list box. */    for (i=0; i < maxmemb; i++)        array[i] = SendDlgItemMessage (hwnd, hdl->listid, LB_GETITEMDATA,                                       i, 0);    return ret;}