Knowledge Base

How to disable dropping of files in RichEdit 2.0

Article ID: 195421

Article Last Modified on 1/23/2007


APPLIES TO


This article was previously published under Q195421

SUMMARY

How do you disable the dropping of files in RichEdit version 2.0 with the CRichEditCtrl class?

Call the RevokeDragDrop(), passing the pointer to the RichEdit control window, as the parameter. Also, override the OnDropFiles() and return without calling the function of the base class.

MORE INFORMATION

To prevent a Drag-and-Drop enabled window from accepting files use the RevokeDragDrop() function. Pass the pointer to the target window as the parameter for the function. The WM_DROPFILES message handler must be overriden and control must be returned from it, without calling the OnDropFiles() function of the base class.

You use this function during the initialization, typically, in the InitInstance() function of the window procedure. Handling the WM_DROPFILES message alone, or calling only the RevokeDragDrop() is not sufficient. To successfully prevent the links from being placed in the RichEdit control version 2.0, you must do both of the previously mentioned steps.

Keywords: kbhowto kbrichedit KB195421