拖拉CListCtrl的Item时,WM_LBUTTONDOWN和LVN_BEGINDRAG之间有什么关系?在哪里对拖拉动作进行处理比较好呢?如何区分

解决方案 »

  1.   

    Common controls normally begin a drag operation in response to the LVN_BEGINDRAG message. You can also take advantage of this message to begin the drag operation. This is where the similarity with Common control drag and drop ends. Common control drag and drop uses mouse messages to control tracking the drag image and processing the drop. You will not be able to use mouse messages because, after you begin the drag operation, control is passed to OLE's DoDragDrop() function.
      

  2.   

    3x,谢谢您的解答。我现在碰到一个问题,就是不知道如何判断,当鼠标左键落下将产生何种动作。
    拖拉可能会产生两种动作,如果鼠标移出窗口,就产生一个Shell文件拖放操作,被拖出去的item所代表的文件将被创建出来;而如果鼠标没有移出窗口,就产生一个内部item重新排序的动作,这两个动作现在看来都是从OnBeginDrag函数开始的,我该如何区分这两个动作呢?
      

  3.   

    LVN_ENDDRAGSee Also
    NMLISTVIEW | WM_NOTIFY | List-View Controls MessagesRequirements
    OS Versions: Windows CE 1.0 and later.
    Header: Commctrl.h.
    This message notifies a list-view control parent window about the end of default processing for a drag and drop operation. It is sent in the form of a WM_NOTIFY message. LVN_ENDDRAG pnmv = (NM_LISTVIEW FAR *) lParam;
    Parameters
    pnmv 
    Pointer to an NMLISTVIEW structure. The iItem member identifies the dragged item, and the ptAction member specifies the screen coordinates of the drop location. The other members are zero. 根据这个消息发生的位置(ptAction),自己判断需要做什么动作
      

  4.   

    http://download.microsoft.com/download/vc42ent/Sample23/1/W9XNT4/EN-US/TreescrA.exe
      

  5.   

    早已搞定,呵呵,原来区分这两个是非常easy的事情:)