PRB: Drag List Box Does Not Send DL_DRAGGING Notification (183115)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0

This article was previously published under Q183115

SYMPTOMS

A drag list box in an improperly coded dialog box sends DL_BEGINDRAG and DL_DROPPED notifications, but no DL_DRAGGING notifications.

CAUSE

The DragList control relies on the value that is returned in response to its DL_BEGINDRAG notification in order to acknowledge the start of the drag. If this value is not returned properly, the further drag messages will not be sent.

RESOLUTION

In a Dialog Box, the value returned from the dialog box procedure is a BOOL that tells DefDlgProc whether or not the message has been handled. The returned value is not the value that is returned as the result of a sent message. To properly return a value from a dialog box procedure, the return value needs to be placed in the DWL_MSGRESULT window long position, and then TRUE must be returned from the dialog box procedure:
   case DL_BEGINDRAG:
      // Keep track of the item number that is being dragged.
      // In this case, store the number in the dialog box's
      // DWL_USER position.
      SetWindowLong(hwnd,DWL_USER,
                    LBItemFromPt(dli->hWnd,dli->ptCursor,FALSE));
      // Store the return value in DWL_MSGRESULT.
      SetWindowLong(hwnd,DWL_MSGRESULT,TRUE);
      return TRUE;

				

STATUS

This behavior is by design.

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbCtrl kbprb KB183115