6

To open one or several files in a specific application i often select the file(s) in explorer and drag them to the target application.

My next step is always to perform some action on the recently opened file in the application dragged to, e.g. to perform a search in a text file opened in a text editor.

But the focus is still on the explorer window where the files were dragged from, so my actions are performed in the wrong window, e.g. pressing Ctrl+F launches a search in explorer instead of in the text editor.

This might sound like a small problem, but I perform this task tens, if not hundreds, of times per day, and can't seem to learn this unintuitive behavior!

Is there any way to modify this behavior? Perhaps with some AutoHotKey magic? Or some registry modifications?

  • 2
    Are you looking for Focus Follows Mouse ? – harrymc Jul 4 '15 at 10:12
  • @harrymc Excellent reference. I urge you to answer the question and include this reference. – misha256 Jul 6 '15 at 23:57
2

Windows does not have a feature for "Focus follows drop", but does have a feature for "Focus Follows Mouse" : When the mouse hovers over a window, it becomes the active window as far as the keyboard is concerned and is brought to the front of all other windows.

Under XP this feature is enabled using TweakUI.

In newer versions of Windows, this is built-into the Ease of Access Center ("Make the mouse easier to use" / "Activate a window by hovering over it with the mouse"). The excellent and free X-Mouse Controls can add a delay to the activation.

  • This would not work for me. I don't want to worry where I leave the cursor when I want to type something. It would be great if a program could intercept every drag-and-drop event and force focus change. – Josip Jul 7 '15 at 17:03
  • 2
    A AutoHotkey script can do that with only a few lines, although the script will need to be written. An example of tracking drag/drop events can be found in this thread, that you would need to first study and understand. – harrymc Jul 7 '15 at 18:10
  • @harrymc I would be interested to understand more about your idea. I looked at the link you posted. My interpretation was that the link is about detecting what is dropped on the AutoHotKey window. However I think the OP is asking about detecting when something is dropped onto the window of another application. – AdamS Oct 29 '17 at 14:06
  • @AdamS: I haven't posted any link to AutoHotKey, and anyway AutoHotKey does not have a window. – harrymc Oct 29 '17 at 14:31
  • 1
    @AdamS: No, I don't know how to intercept a drop in AHK, except by tracking the mouse movement, detect drag and give focus to the window underneath. This is rather mechanical and can cause problems with some operations. – harrymc Oct 29 '17 at 18:36
1
+50

The following registry setting would help in achieving it :

Use regedit to go to: HKEY_CURRENT_USER\Control Panel\Desktop.

Double-click on ForegroundLockTimeout and set its value in hexadecimal to 30d40.

Press OK and exit regedit.

Reboot your PC for the changes to take effect.

  • Please can you explain how this helps with the original question? – AdamS Oct 29 '17 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.