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


In reply to (Got it) Re: Re: Re: Windows drag and drop by osfameron
in thread Windows drag and drop by fredt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.