Jump to content

Windows Drag and Drop Handler Shell Extension


Recommended Posts

I'm writing a drag and drop handler shell extension and I would like to be able to get the process from which the drag operation originated. So if you dropped from a 3rd party file manager onto the desktop for example, I'd like to be able to get the PID of the source application (the file manager). Is this possible? So far I'm able to get the destination PID from the window handle of the context menu, but this is not useful for my purpose. Any ideas?

Link to comment
Share on other sites

The ATL part isn't really important, but yeah, I'm having the same problem finding any information on it. The best I've found was in the source for SuperCopier where they enumerate the available clipboard formats, looking for one that is used exclusively by explorer. It works for identifying explorer as the source of the drop, but that's about all.

Essentially I'm writing an extension to become the default copy/move handler for the system, even on left button drag/drops. However I think this will mess up certain apps like 7-zip, so I want to try and filter the interception. I was hoping for a better solution than SC's, but I've come up empty so far.

Link to comment
Share on other sites

I have... in fact I'm trying to build similar functionality for FastCopy. TeraCopy does a few things I don't like. It screws up permissions sometimes when moving files on the same volume, resulting in files/folders with the lock icon on Win7. It also doesn't have as many options as FastCopy does for what is copied. I'd love to see Tera's source to see how they do it, but alas no joy there.

Link to comment
Share on other sites

I remember a microsoft dev saying that most explorer problems they got were caused by badly written shell-handers. They _hated_ them :huh2:

My response would have been: "Don't make writing shell extensions so arbitrarily complex."
Link to comment
Share on other sites

Any users of FastCopy out there that would like to give my shell extensions a try? Basic rundown:

- makes FastCopy the default copy/move handler, works for drag and drop and Ctrl-C|X / Ctrl-V

- intercepts operations from Explorer and probably most 3rd party file managers, does not interfere with other apps like 7-zip

- bypass by holding the left Windows key, the Windows copy handler will be invoked instead

- FastCopy has a few different copy modes which can be configured by INI file

- set options for general FastCopy behavior in INI file

- default options are: /cmd=force_copy /auto_close

- both x86 and x64 versions

- built with VS2010, so you'll probably need the VC++ 2010 runtimes

If you have TeraCopy installed and want to try this, you'll probably have to completely uninstall TeraCopy, since the app does not properly remove the x64 registry entries via the options GUI (works ok for the x86 entries though). I have two extensions and an INI file - drop all three in the FastCopy installation directory, edit the INI for your preferred options (or delete it or leave the defaults), and register the two DLLs.

Let me know if interested, and I can send you the files.

Edited by wraithdu
Link to comment
Share on other sites

Note about the 7-zip problem:

I thought this was interesting once I figured out what was going wrong. When dragging out of 7-zip, 7-zip first unzips the files to a temp directory, then invokes the shell with the paths to the temp files. It waits for the shell operation to complete then deletes the temp files. In the case of intercepting the copy/move with FastCopy (same problem with TeraCopy or SuperCopier), once the extension invokes FastCopy it returns, which tells 7-zip everything is done even when it is not and 7-zip deletes the temp files before FastCopy can copy them. I tried to make the shell extension wait for FastCopy to finish via a call to WaitForSingleObject, but this actually freezes the ENTIRE shell until it returns. It's not noticeable for quick operations, but on a long unzip, then shell will think it has crashed and you'll get the "not responding" warning. So in the end I can make it works with apps like 7-zip, but the shell doesn't cooperate to make it practical.

Link to comment
Share on other sites

Have anyone experienced these issues with Explorer?

Win XP Gold

Explorer crashed before installing any 3rd party software.I have installed XP on many machines and I found it true. I used to test beta XP releases and the last was rock solid. The RTM was terrible as far as explorer was concerned. Solution: SP1+

Win 7 Gold

Explorer can cause all processes to become unresponsive. Reboot when happens, expect hanging OS. Shutdown Explorer and open Explorer may help with luck. Solution: Do not keep Explorer open. Close Explorer as soon as you can to avoid trouble. Solution: Avoid long term use.

Anyone else got solutions to work around the known Explorer problems?

Link to comment
Share on other sites

  • 5 months later...

Any users of FastCopy out there that would like to give my shell extensions a try? Basic rundown: - makes FastCopy the default copy/move handler, works for drag and drop and Ctrl-C|X / Ctrl-V - intercepts operations from Explorer and probably most 3rd party file managers, does not interfere with other apps like 7-zip - bypass by holding the left Windows key, the Windows copy handler will be invoked instead - FastCopy has a few different copy modes which can be configured by INI file - set options for general FastCopy behavior in INI file - default options are: /cmd=force_copy /auto_close - both x86 and x64 versions - built with VS2010, so you'll probably need the VC++ 2010 runtimes If you have TeraCopy installed and want to try this, you'll probably have to completely uninstall TeraCopy, since the app does not properly remove the x64 registry entries via the options GUI (works ok for the x86 entries though). I have two extensions and an INI file - drop all three in the FastCopy installation directory, edit the INI for your preferred options (or delete it or leave the defaults), and register the two DLLs. Let me know if interested, and I can send you the files.

This is not a new topic, but I would like to try your files to register Fastcopy as the default copy handler. Are you still working on this?

Link to comment
Share on other sites

  • 2 years later...

Ahoi,

is this available for download anywhere? Other copy utilities like Perigee make their own Move context-menu entry the default for drag & drop (optionally), but there doesn't seem to be a simple registry hack to make that possible for FastCopy. So it even after all this time your solution is still interesting.

Thanks in advance!

Edited by TimurBorn
Link to comment
Share on other sites

  • 5 years later...
On 6/11/2011 at 12:05 PM, wraithdu said:

Any users of FastCopy out there that would like to give my shell extensions a try? Basic rundown:

- makes FastCopy the default copy/move handler, works for drag and drop and Ctrl-C|X / Ctrl-V

- intercepts operations from Explorer and probably most 3rd party file managers, does not interfere with other apps like 7-zip

...

Let me know if interested, and I can send you the files.

Is this a project you finished?  Can you send it or provide a link?

Even if it's just the code of something partially completed, I'd be interested.  Just for my personal use.

Perhaps myself and others could pick up the baton and carry it further along, while giving original credit to you, of course.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...