in reply to Re: Re: Windows drag and drop
in thread Windows drag and drop

OK I think I understand you... I found a solution for my Win2K box but please bear in mind that

  1. I still think it's a bad idea ;->
  2. It involves editing the Registry: search www.microsoft.com, or speak to your neighbourhood NT hacker if you aren't aware of the potential consequences of this. I've not tested to see if there are side-effects.
  3. (Also there may be a better solution: particularly Activestate or others might offer a solution that doesn't involve manually hacking the registry)

I fired up regedit to have a look in the registry:
It looks like the property of a filetype being able to accept dropped files, e.g. like batfile is stored in the registry under HKEY_CLASSES_ROOT\batfile\shellex\DropHandler

So if you created the keys under (in this case) HKEY_CLASSES_ROOT\perl\ for shellex and DropHandler and then copied the name of the handler CLSID into the default value (which on my system is {86C86720-42A0-1069-A2E8-08002B30309D} - don't you love the way Windows is so easy to use), it might work on the basis that... err... they're both console applications. Perhaps a monk who knows NT really well can give more insight?

Anyway, I tested and was able to drop a text file onto a perl script which ran it - I think this was what you were looking for.
You may want to be more scientific that I was... no warranty express or implied...

Update: More poking around in the registry. That class ID (the nasty looking hex string above) represents the .exe drop handler which fits nicely. It is enabled in the same way (e.g. under ShellEx\DropHander for .bat, .cmd, .com, .exe, .pif, and also for .scr (screen savers!) and shcmdfile Explorer commands. OK off topic for Perl but I'd like to understand more about this. I think O'Reilly have a book on Windows NT Shell Extensions

Update2: After following Boo's link to MSDN I came across Microsoft's admonition:

It is not recommended that you copy existing file associations from the registry. This often leads to the propagation of poorly formed file associations. Instead, you should follow the steps outlined in...
So there's some stern advice against following the instructions above... you have been warned!

Update3 (a bit OT):The O'Reilly book I found is Visual Basic Shell Programming Integrating Applications with the Windows Shell which is out of print, but there is more information on http://www.oreilly.com/catalog/vbshell/ including a link to read more about it online. I'm sure they had a non VB specific book too, but this looks interesting. Apologies if off-topic.

Cheerio!
Osfameron