Alex Rivera | Logout

C# Drag drop does not work on windows 7

Asked 2010-05-14T11:22:29.743
48

I have had a project for quite a while using C# winforms. I implemented a drag-drop function before windows 7 was released. Worked like a charm. However, when using windows 7 it does not work. The event doesn't even get triggered.

AllowDrop is set to true. When subscribing to DragEnter it does not get called in windows 7 (not sure about vista). But on XP it works all the way. The program is run with administritave priviliges.

Is there any difference in the drag drop in windows 7 vs xp? Don't know if it's relevant, but I'm using x64

Edit
Report

1 Answer

1

A Minor addition to dmex's post. The following defines the variables and the constant.

private const uint WM_DROPFILES = 0x233;
private const uint WM_COPYDATA = 0x004A;
private const uint WM_COPYGLOBALDATA = 0x0049;
private const uint MSGFLT_ADD = 1;

Also, you may want to consider using ChangeWindowMessageFilterEx if you're application is on Windows 7. I also believe that OLE drag and drop may not use Windows messaging. So it wouldn't effect that at all.

answered 2010-10-27T15:08:14.740

Your Answer