简体   繁体   中英

Restore file drag and drop

I want to block file drag and drop on an application. For this, I can use win32 API

[DllImport("ole32.dll")]
public static extern int RevokeDragDrop(UIntPtr hwnd);

Now, I would like to restore the drag and drop for that application. Is there any API to restore it back?

You'd use the RegisterDragDrop function, which is how it was (likely) originally set.

From https://docs.microsoft.com/en-us/windows/win32/api/ole2/nf-ole2-registerdragdrop :

If your application can accept dropped objects during OLE drag-and-drop operations, you must call the RegisterDragDrop function. Do this whenever one of your application windows is available as a potential drop target, ie, when the window appears unobscured on the screen.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM