When people ask to disable drag and drop, they often are trying to disable accidental drag and drop

We occasionally get customers who ask, "How do I disable drag and drop?" This is an odd request, so we ask the frequent follow-up question, "What are you really trying to do?" For many of these customers, the answer goes something like this:

We've found that our employees often accidentally move or copy items around on the desktop and in Explorer windows because the act of pressing the mouse button causes the mouse itself to slide slightly across the table, resulting in a drag operation instead of a single click. We then have to spend a good amount of time searching for where those files ended up and trying to get their system back to its original state. We'd therefore like to disable drag and drop to avoid this problem.

They aren't really trying to disable drag and drop. They are merely trying to disable accidental drag and drop.

To avoid accidental drag and drop, adjust the drag sensitivity so that it takes a greater effort to trigger a drag and drop operation. By default, the mouse needs to travel four pixels with the button held down for a drag operation to be initiated. To make it harder to initiate an accidental drag operation, just crank this number higher.

This particular customer might decide to crank the drag threshold to 50 or 100 pixels, so that the mouse has to move quite a significant distance before it is interpreted as a drag operation.

By the way, the function for changing the drag threshold is SystemParametersInfo; check out the SPI_SETDRAGHEIGHT and SPI_SETDRAGWIDTH parameters.

Pre-emptive correction: Do not modify the registry directly. Use the API. That's why it's there.

Comments (62)
  1. cclarke says:

    As another option, if you accidentally drag a file/folder into another folder, press Ctrl-Z to undo the drag operation.

  2. someone else says:

    This is also in TweakUI, for those without appropriate compilers. And even better, it’s a per-user setting, taking effect immediately.

    So why isn’t this in the mouse cpl?

  3. Adrian says:

    We had a few incidents of this a while back.  Some of the tech writers in our group thought that mapping a network drive created a logical view.  They then started rearranging thousands of files, believing they were only changing their view rather than pulling the rug out from everyone else.

    Happened twice before a notice went out to everyone explaining what not to do.

    Happened one more time when someone returned from vacation and hadn’t yet read his email.

  4. John says:

    "Do not modify the registry directly. Use the API. That’s why it’s there."

    YES.  I work with a product which deploys a driver at runtime.  Instead of hooking it up through SCM, the author creates the registry entries manually and calls NtLoadDriver.  This is frustrating because you cannot interact with the driver (i.e. via sc.exe) until you reboot.

  5. Susan says:

    But I’m an IT admin who doesn’t know how to edit the API.  Every week there is a person in the office that drags their folders all over the place, I think I still need to do the registry because I need this globally for him.

  6. Marcus says:


    See "someone else"’s comment.  

    Ignorance of how to do things the right way is never an excuse for doing things the wrong way.

  7. steven says:

    Susan, please don’t. It’s not the API that you’re editing, but the system parameters anyway. If you want to change the values, find a utility that can do it such as TweakUI (on XP, not sure if there’s a similar thing for Vista), which was written by Raymond himself and is sure to do the right thing.

    Writing such a tool would be only a handful of lines of code anyway and with the info provided by Raymond even a semi-decent programmer can knock it up in minutes.

  8. Gabest says:

    "As another option, if you accidentally drag a file/folder into another folder, press Ctrl-Z to undo the drag operation."

    taking about undo, xp’s explorer had the undo icon on the toolbar, if you pressed it accidentally then who-knows-what you just un-did, no feedback, lot of fun :D

  9. someone else says:

    “Writing such a tool would be only a handful of lines of code anyway and with the info provided by Raymond even a semi-decent programmer can knock it up in minutes.”

    Assuming one has a compiler (and possibly the SDK) installed.

  10. steven says:

    "Assuming one has a compiler (and possibly the SDK) installed."

    Which that semi-decent programmer would have. If not, the Express editions are only a download away.

  11. Zian says:

    Steven, you’re assuming a semi-decent programmer would want to figure out how to set up a full-blown Win32 developing environment, which is not trivial to do even after installing Visual Studio 2008. For starters, there’s no easy way to call those APIs in .NET languages.

  12. Susan says:

    How about making this natively adjustable in the OS. By the time you figure out files have moved it’s too late to do a controlz.

    Seriously I have to dig out entire tree file structures on a regular basis.

    I’ve tried different mouses, slowing them down, and all sorts of things to fix this issue were we have key older employees that accidentally move things and don’t realize the issue.

    You say "use the API" but I’m an admin.  I don’t know what you mean exactly?  Short of using TweakUI on a desktop by desktop basis, is there a way to group policy adjust this?

  13. "Of course, if you’re a ‘semi-decent programmer’ you should be able to get a Win32 console app written to do this with VS2008 and MSDN in half an hour."

    Indeed. I managed to do it in eleven minutes. Perhaps I’ll post the utility, if it’s in that much demand.

  14. If you start getting the same question over and over it’s a good time to look for an underlying cause.

    As screen resolutions get bigger, mouse movements need to cover a wider swath of pixels, which makes fine movements more difficult.

    Maybe SM_CXDRAG and SM_CYDRAG are too small?

  15. Ben Voigt [C++ MVP] says:

    In some cases distance doesn’t matter.  Maybe with certain input devices (especially touchpads, but sometimes also mice with worn-out/misadjusted buttons), it common for a hold+drag operation to report that the mouse was released momentarily midway.  Or a cursor movement operation (slide across touchpad) is turned into drag-and-drop (tap and slide) by glitches.  Is there any way to debounce that problem, by e.g. decreeing that button presses or releases of less than 8ms in duration are ignored?

  16. Roman says:

    I wonder why can the width and the height be set separately?

  17. mpbk says:

    "I wonder why can the width and the height be set separately?"

    The cost of programming in separate width and height sensitivities is negligible, with the possible future benefit of handling non-uniform DPI mice or screens.  Many programmers who have lots of experience program in seemingly needless (at the time) flexibility in case of a future that hadn’t been previously thought of.

  18. someone else says:


    “As screen resolutions get bigger, mouse movements need to cover a wider swath of pixels, which makes fine movements more difficult.”

    That’s what pointer acceleration is for.

    @Ben Voigt:

    Disable the tapping. Your touchpad driver should support it.

  19. ST says:

    "I wonder why can the width and the height be set separately?"

    My theory on this in the windows SDK is that pixels haven’t always been square. They are now, but some of the older pre-VGA video technologies had non-square pixels. You need to specify horizontal and vertical seperated if you use pixels as units and your pixels aren’t square.

  20. Nick says:


    If you’re a "semi-decent programmer"*, using simple Win32 API calls from .NET shouldn’t be a problem.

    Of course, if you’re a "semi-decent programmer"* you should be able to get a Win32 console app written to do this with VS2008 and MSDN in half an hour.  Calling a few API functions is hardly "full-blown Win32 development".

    *Assuming, obviously, you know the relevant languages (C#, VB, C/C++, COBOL.NET, whatever).

  21. dal says:

    This is advising people to make micro-adjustments to barely understood system parameters, and it does not directly solve the problem. Adjusting drag sensitivity will not stop the general problem of people accidentally deleting/moving/copying a file they did not intend to. A good, easy-to-use and understand undo/redo mechanism would solve most of these problems.

  22. GregM says:

    ST, it sometimes still is.  1280×1024 has non-square pixels.  You need 1280×960 for square.  (I did have a video card that did that once.)

  23. Joseph Koss says:

    1280×1024 has square pixels on 5:4 LCD monitors.

    That 1280×960 (4:3) has non-square pixels on those same LCD’s.

    I would suggest that if your LCD’s native resolution is 1280×1024, then its a 5:4, with square pixels.

  24. Tom M says:

    I think the problem is the explorer tree view, where an accidental drag and drop operation can occur on a networked drive with no undo. It’s only a problem when moving folders this way, as to move files you have to select them in the right hand pane, and move them to the left hand pane, or at least some other fairly significant distance. I think that the solution is to add a confirmation prompt when moving folders from the left hand pane, to the left hand pane via a drag and drop operation.

    At the very least you need to be able to find out what you’ve done.

  25. Jules says:

    Joseph Koss: "I would suggest that if your LCD’s native resolution is 1280×1024, then its a 5:4, with square pixels."

    Doesn’t seem to be generally true. My monitors (which are these: http://www.amazon.com/NEC-MultiSync-LCD1700V-BK-Monitor-Black/dp/B000060NXB ) are 1280×1024 native, but I’ve just measured them and they’re definitely 4:3 ratio.

  26. Joseph Koss says:


    According to http://en.wikipedia.org/wiki/SXGA your 4:3 aspect 1280×1024 LCD is not typical

    Non-square pixels on an LCD is anything but typical, and I imagine that you end up having all sorts of problems because of it (all software, including operating systems, assume square pixels)

  27. Josh Straub says:

    I was the system admin for a medium size Citrix & LAN system at a mortgage company (lots of files and documents to be dealt with, avg 250 pages per mortgage).

    The scanning-and-filing people kept accidentally drag and dropping entire folders of documents into the folder adjacent to it via the TreeView in Windows Explorer.  Soon an entire months’ worth of documents would be missing and catastrophe would ensue.  I would get a call and have to find the missing folder, and then drill down to the NTFS Owner to discover which user "created" the new location.

    They kept doing this on almost a weekly basis.  It would be great if I could have disabled their permissions to Create new folders or move old ones, via NTFS, but the NTFS Special Permissions are strange and useless in this situation.  It was a few years ago but I recall something like the "Create Folder" permission was necessary for renaming files as well?  So I couldn’t simply deny them that permission.

    One thing I know for sure – it was a real UI disaster for our company and I had a tough time dealing with it.

  28. Anonymous Coward says:

    I think the root cause of the problem is that Windows was designed on the assumption that the input hardware would be decent, that the mouse would not suddenly jump around hugely when you click, etc.

    I think that the employers mentioned in the article are just seeing the effect of giving their employees crappy mice. The first thing I thought when I read was ‘these mice got to be against regulations’. They sound like nice little RSI inducers. And good mice aren’t even expensive anymore.

  29. Herbert says:

    1) Why does MSFT not make Windows adaptive to the environment? Is it really that thousands out there need to create a workaround?

    That starts with adapting to the number of monitors connected, dedecting beamers without reboot…

    2) the current generation of .NET / Java students don’t care about operating system APIs. Either the language environment is complete, or it needs to be improved. Obviously there’s a lot of OS abstraction needed in the .NET libraries. Don’t spend your time riding a dead horse = learning Win API!

  30. GregM says:

    "According to http://en.wikipedia.org/wiki/SXGA your 4:3 aspect 1280×1024 LCD is not typical

    Non-square pixels on an LCD is anything but typical,"

    If you have a 1280×1024 LCD with square pixels, then you’ll get non-aquare pixels with all other resolutions.

    Also, LCDs aren’t the entire world.

    "and I imagine that you end up having all sorts of problems because of it"

    The biggest problem that you’ll have is that things will appear squished vertically.

    "(all software, including operating systems, assume square pixels)"

    That’s not true.  My software assumes square pixels only until you tell it otherwise by telling it how big your monitor is.  That not only gets rid of the distortion, but also allows it to display a 1" circle at a scale of 1:1 as 1" on your monitor.

  31. Susan says:

    We have $90 adjustable mice.  Define "crappy mice" because crappy mice must not be the cheap kind?

    We’re talking treeview, windows explorer, and all I keep hearing is use the API.  Okay Microsoft, use the API because this is a weekly chore in my office and we don’t have our files in a SQL database.  And yes you can’t adjust the NTFS permissions.  So my solutions are limited.

  32. Joseph Koss says:


    Yes, but any other resolution isnt native.

    It is interresting to note that based on Valve’s Steam survey 1280×1024 is the most common desktop resolution .. comprising 24.01% of all users surveyed as of march 2009.


    Valve surely has the second largest hardware survey data around (Microsoft having the largest)

    So no, LCD’s arent the entire world, but 1280×1024 LCD’s is as close as it gets.

    When I was shopping for an LCD, all the 1280×1024 LCD’s I considered were 5:4 aspect. I am actualy suprised to learn that there are any 4:3’s

  33. porter says:

    > all software, including operating systems, assume square pixels

    Presumably ignorance simplifies arguments.

  34. Mark says:

    Susan: try the link under my name.

    This is a programming blog, so expect discussion of programming issues.

  35. jan_bar says:

    I have another trouble with drag and drop in explorer. Sometimes it happens that explorer view is refreshed because of some change in folder structure and at the same time I drop files. The drop will occur in wrong place. Besides Undo there is no way back.

  36. Mark says:

    jan_bar: and accidentally dragging over something that takes ages to enumerate like Bluetooth Places just makes you want to throw your hands up in despair.  But that would cancel the drag…

  37. Anonymous says:

    When did this blog entry move from drag and drop to remodelling Windows?

  38. Nathan Smith says:

    …when the author of the post and several follow on posters completely ignored the context of the issue, i.e. that system administrators could not adjust this in a non-progammatic fashion.

    This post and a number of the follow ons are symptomatic of developers that think within very narrow parameters and give little thought to usability, particularly at scale.

  39. Michael Hale says:

    Yes, on second thought I realize I was inappropriate.  I am terribly impulsive sometimes.  Thank you for the scale comment.  I will think about that.  I will go back to Soma’s post for more guidance.

  40. Dear Mr. Chen,

    I am sure you know much more about this than I do, but from my perspective it seems that in the beginning there was a Start button…

    Unfortunately, due to the technological limitations of the times, the computer couldn’t read your mind and start what you wanted, so it had to open a menu with a tree for the user to navigate through.

    My apologies in advance for inconsistencies.

    Working title: Windows Integrated Programming, one Work In Progress


    Pixel 1: The Structure


    Some rough notes:

    A Value Graph

    Value can be thought of as the System’s best estimate of a User’s current desire to perform an action.

    Value is not a simple type, but is always normalized to a value between 0 and 1 when a query is executed on the graph.

    The current state of the UI defines a View on the structure that allows for improved performance.

    Value is propagated through the graph during a query based on the edge types.

    Value is cached on certain entities to improve performance on repeated queries.

    Let’s assume that we have defined a few basic entity types (UID’s assumed, would be more complicated with security issues taken into account, (?) == nullable

    field, and a few of these would be many-to-many relations):

    System      (Name, UserSet)

    User        (Name, SystemRef, FolderSet)

    Folder      (Name, SystemRef, UserRef, FolderRef(?), FolderSet)

    Application (Name, UserRef, FolderRef)

    Playlist    (Name, UserRef, FolderRef, SongSet)

    Song        (Name, UserRef, FolderRef, PlaylistRef, ArtistName, AlbumName, Number)

    Document    (Name, UserRef, FolderRef)


    Here is some example data:

    System(MyComp, …)

    User(Admin, MyComp, …)

    User(Michael, MyComp, …)

    User(Raymond, MyComp, …)

    Folder(Public, MyComp, Admin, null, …)

    Folder(MikeMusic, MyComp, Michael, Public, …)

    Folder(RayDocs, MyComp, Raymond, Public, …)

    Application(Browser, Admin, Public)

    Application(Jukebox, Michael, MikeMusic)

    Application(Editor, Raymond, RayDocs)

    Playlist(Classical, Admin, MikeMusic, …)

    Song(Song1, Admin, MikeMusic, Classical, Berlioz, Eastern Classics, 1)

    Song(Song2, Admin, MikeMusic, Classical, Chopin, Western Classics, 2)

    Document(Notes, Raymond, RayDocs)

    Now let’s define a few basic actions:

    A User can Login to a  System,

    A User can Logout of a System,

    A User/System can Open a Folder,

    A User/System can Move a Folder,

    A User/System can Rename a Folder,

    A User/System can Start an Application,

    A User/System can Command an Application,

    Jukebox can Open a Playlist,

    Jukebox can Play a Song,

    Browser can Navigate to a URI,

    Editor can Open a Document

    Now let’s define some edge types for the nodes in our graph:

    Containment (built into the entities, User is contained by System, Song is contained by Playlist and Folder)

    – Value flows up through the containment hierarchy during a query

    Frequency (tallies the number of times a user connects two entities with an interaction, how value is deposited in the system)

    The main purpose of the structure is to be able to efficiently retrieve recommendations based on queries that generate value estimations of the entities.

    It seems like the structure should also tie into the keyword tree/tag cloud used for search indexing, but my mind has run out of things to say for the



    FFF -> For Future Faxes


    Pixel 2: The Grammar – generating sequences of views and actions as you work

    Pixel 3: The Compiler – reducing value for efficiency and trimming/reorganizing the structure

    Pixel 4: Data Extensions – talking to the internet

    TODO: Read some prior art?

    TODO: Send more faxes?

    TODO: Send mail with visuals?

    TODO: Collaborate with the team?

    TODO: Write specs?

    TODO: Make it?


    Michael Hale

  41. If anyone is interested, and if Raymond will indulge my posting, I did put together a simple command-line utility, as I mentioned in an earlier post. Just click my name above to go to the site. Source is also provided.

    As for the subject at hand, perhaps there should be a way to set this through policies, etc., but the post is about how to change a setting *now*, the way that Windows currently exists, to get past this annoyance. That’s outside the ken of some administrators, perhaps, but for anyone that’s passingly familiar with Windows programming it’s not that hard to write a simple utility. This is, after all, a Windows programming blog.

  42. someone else says:

    And don’t forget: If your mouse sucks, you can still use the context menu (at least in explorer).

  43. someone else says:

    And don’t forget: If your mouse sucks, you can still use the context menu (at least in explorer).

  44. fix_paul says:

    When we’re at programming topics:

    Paul M. Parks made the utility, and writes: "executable is 164KB. I linked in the C runtime library so you wouldn’t have to install the Visual Studio 2008 distributable package just to run a simple command-line utility."

    Well I used Visual C++ 6 from 1998, tweaked and recompiled his source. On the above link (behind fix_paul) you can get 2.6 KB zip containing both the EXE, the source cpp file and the bat for the compilation. It doesn’t need any other libraries, it uses MSVCRT.DLL which exists on every Windows since 1999.

    By the way, it’s very hard to use VS 2008 to link with MSVCRT. Not a good decision by people who made it, in my opinion.

  45. Paul M. Parks says:

    @fix_paul: I wrote quite a bit more than that. This just proves that a nitpicker’s corner only attracts nitpickers. I should have known better.

  46. Simon Buchan says:

    @fix_paul: I get around that by not using C runtime functions. Of course, now I’m not going to compile on linux….

  47. fix_paul says:

    Paul M. Parks: "I wrote quite a bit more than that"

    I don’t know what you mean by that.

    Can you please elaborate which additional functionality (for a user) your 168KB EXE has which my 3.5 KB EXE doesn’t? Except that you link statically with "oh so great" VS 2008 libraries?

  48. Gabe says:

    Jules, the link to the supposedly 4:3 monitor contains a link to a manual. That manual says the display area is 338x270mm, which yields .264x.264mm pixels at 1280×1024. Either you measured wrong or NEC did.

  49. Mark says:

    Simon: your whitespace parsing code is almost certainly wrong, as well ;-)

    fix_paul: I don’t think he implied that.  Still, it might make the utility seem more valuable.

  50. Dean Harding says:

    fix_paul: he means you just picked up on the "164KB" part of his post as if that was the most important thing. Seriously, there’s not that much difference between 168KB and 3.5KB. It took me about 3 seconds to download his version. How much time does your version save?

    If his had been 10MB and your was 5KB, then you’d have a point. But not in this case…

  51. Johan says:

    I once worked for a company that also had this problem. They used touchscreen displays, which would make it very easy to accidentally drag and drop something (like the windows system32 folder for example).

    They also discovered this setting, but they insisted on a ridiculous high value of 99999 pixels, which would essentially disable drag and drop. Very annoying, as this also makes impossible to drag windows with the mouse!

    I tried to convince them to use a more reasonable setting like 50 pixels. But they refused. Someone ‘decided’ that this setting should be set to 99999 and Bad Things would happen if they changed it…

    Oh man, I wasted hours at that company trying to convince people of things that should be obvious to anyone.

  52. fix_paul says:

    as if that was the most important thing.

    Yes it is, because his message was in fact "this is smallest it can be if you don’t have to download VC 2008 redistributables, or redistributables of some other language."

    "there’s not that much difference between 168KB and 3.5KB"

    About 45 TIMES difference not that much? That’s exactly the attitude of programmers producing bloat. If you have the computer for only one program, of course you don’t care, but otherwise size does matter. You’re probably lucky regarding your low computing demands. But as you are certainly a programmer, I believe a lot of people reading your claims now think "thanks God for having enough competition which really isn’t."

    And my second point was that I consider mentioned decisions of VS 2008 team bad. Continuing to the "competition" line of thought, it appears to me that such decisions can also be intentional.

  53. Mike Dimmick says:

    Our solution to this was to deny write access to certain folders within our archive tree. You have to log on with a specific account. In fact the ACLs are set up with specific groups which allows us to change the decisions later.

    We then have a service which monitors the folder tree: when a new folder for a customer or for a new project for that customer is created, it creates the appropriate subfolders with the correct security. It also fixes the ownership (removing the ‘owner can do anything’ loophole) and adds a project number for a new project.

    You do have to stop the service to delete an accidentally created folder, because the FileSystemWatcher holds locks on folders that contain folders it’s watching.

    Many users may well be better off with SharePoint than with a Windows file share.

  54. @fix_paul: Rather than take up more space on Raymond’s blog about this, I’ll just direct you to the new comment added to my page (click my name above). That’s all I care to say about it.

  55. N'Go says:


    You are right for the icon, but if you hover over the undo menu entry then there will be an info in the status bar what Windows intends to undo.

  56. GrumpyYoungMan says:


    Let’s see, 136kB of a 120GB hard disk is ~0.000001344.  What was your point again?

    Since you’re becoming tedious, I shall now callously point out that this page (as of this posting) takes a horrifyingly profligate 219kB to download.  Perhaps you should consider the enormity of that waste before viewing this page again.

  57. Sunday says:

    Since the discussion has degenerated into something else, I will also state my support for fight until death against bloat.

    Long live efficiency and non-wastefulness!

  58. fix_paul says:

    Paul M, I don’t understand why you feel attacked in any way. My subject was VS 2008. You wrote yourself: "I made the source freely available, with no strings, in case anyone wanted to tweak it."

    That’s exactly what I did, I tweaked it to demonstrate how for given purposes (small utilities) "new and improved" VS 2008 *by design* produces very poor results compared to the VS 6 made 10 years ago. And that VS 6 does it via simple "link to dynamic runtime" (MD) switch.

  59. Anonymous says:

    What’s betting fix_paul was really Alexandre?

  60. carlso says:

    I don’t mind an accidental drag/drop every now and then IF I CAN TELL FROM THE UI THAT THE OPERATION JUST HAPPENED SO THAT I CAN UNDO IT.

    I use a touchpad on my laptop and every so often, rapidly moving the mouse cursor with the touchpad will result in an unexpected drag/drop (I guess it’s picking up my pressing the pad while sliding my finger as a click).

    What I cannot understand is that Windows Explorer provides no striking visual feedback to let me know that I just did a drag/drop operation, so unless I am really paying attention, I’ve often missed the fact that I’ve inadvertently moved a folder into another one, for example.

    What really bugs me about Vista is that Explorer, instead of providing feedback for such important events like this, it goes out of its way to provide visual feedback for non-events such as moving the mouse over items!  What purpose can highlighting an item on mouse hover possibly serve?  I’ve never understood why people want to change the graphic of an icon on mouse hover.  We all know that you can click on icons, so the hover highlight makes no sense.  It’s worse than that.  It’s visually distracting.

    For Windows Explorer, this should be the rule:  Nothing on the screen changes its appearance unless something MEANINGFUL happens to it.  For example, if I move an item into a folder, the folder should blink or animate to give me feedback that something just happened.

    That way, when you’re using Explorer, you know that "no visual changes in appearance" == "nothing has happened."  "Visual change in appearance" == "something just happened."

    This current behavior of changing visual appearances of items in Windows Explorer for non-events (like mouse hover) drives me crazy.  I was hoping that someone involved with UI design at Microsoft would fix this in Windows 7, but so far, it looks like it’s still an issue.

  61. Yuhong Bao says:

    fix_paul: Someone figured a way to link with MSVCRT.DLL with newer versions of Visual C++ using libraries from the WDK:


Comments are closed.

Skip to main content