SAMPLE: MFCDRAG Implements Drag&Drop Between CListCtrl & CTree

ID: Q148738


The information in this article applies to:


SUMMARY

MFCDRAG shows how to implement drag and drop between a CListCtrl and CTreeCtrl. The program creates a splitter window containing four panes. Two panes contain CListCtrls and the other two contain CTreeCtrls. You can drag an item from any window to another. For example, dragging can occur between the following panes:

CListCtrl to CTreeCtrl
CListCtrl to CListCtrl
CTreeCtrl to CListCtrl
CTreeCtrl to CTreeCtrl
Code marked with the comment "Added 7/29/96" was added to support a change in the CreateDragImage function in MFC 4.2. The CImageList pointer returned from CreateDragImage must now be explicitly deleted. If you are using a version of MFC prior to 4.2, please comment this code out.

The following file is available for download from the Microsoft Software Library:
~ Mfcdrag.exe
For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
NOTE: Use the -d option when running MFCDRAG.EXE to decompress the file and recreate the proper directory structure.

Additional query words: drag drop


Keywords          : kbfile kbprg kbsample kbMFC KbUIDesign kbVC kbVC400 kbVC410 kbVC500 kbVC600 
Version           : 4.0 4.1 5.0 6.0
Platform          : NT WINDOWS 
Issue type        : 

Last Reviewed: July 16, 1999