Skip to content
 

Windows Drag Sensitivity Utility

Inspired by an article by Raymond Chen about how to correctly change the Windows mouse drag sensitivity, I wrote a quick utility called dragsens. It’s a small command-line utility that will allow you to change the number of pixels the mouse has to travel before a drag operation is initiated. Just download and unzip the utility, then run it at the command line, supplying a single parameter that is the number of pixels for the mouse to travel.

In Raymond’s honor, I’ll provide my own pre-emptive snarky comment: “That executable is 164KB! I could write that in only 4KB!”

Of course you could. So could I. 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. I don’t normally do that with typical desktop applications, but for small utilities like this it saves a lot of trouble.

If you’d like modify the utility, or examine its source, you may download the Visual Studio 2008 project. If you just want the utility itself, you may download a ZIP of the executable.

About the Utility

The utility is actually very simple. It accepts a single parameter, which is the number of pixels the mouse must travel with a button depressed before the motion registers as a drag action. Rather than separate out the width and height, I just set both to the same number since this is generally all that’s necessary.

BOOL success = FALSE;

success = SystemParametersInfo(SPI_SETDRAGWIDTH, numPixels, NULL, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);

if (!success)
{
  DWORD error = GetLastError();
  std::wcout << L"Error " << std::hex << error << std::dec << " while setting drag width." << std::endl;
  return 1;
}

success = SystemParametersInfo(SPI_SETDRAGHEIGHT, numPixels, NULL, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);

if (!success)
{
  DWORD error = GetLastError();
  std::wcout << L"Error " << std::hex << error << std::dec << " while setting drag height." << std::endl;
  return 1;
}

It would be fairly simple to modify the application to set the width and height independently, if you so desired.

Update

I'm already at version 1.1. I decided to add a version resource and support for a "/?" parameter.

About the Snarky Comments

Please see the entry entitled Pre-emptive Snarkiness for my response to the comments about my utility that were posted on Raymond's blog.

Share

3 Comments

  1. acatalept says:

    Great work, and a huge help. Been trying to find a solution to this for a long time.

    Note that one can effectively disable Windows's native drag and drop completely by setting this threshold great than the display's resolution (e.g., 2000 for a 1920×1080 display).

    Thanks!

  2. Anonymous says:

    Thank you so much!! I've been looking for something like this since I'm not a programmer.

  3. Paul M. Parks says:

    You're quite welcome. I'm glad you found it useful.

Leave a Reply