On Mon, 2003-06-30 at 23:35, Tom Felker wrote:
> On Mon, 2003-06-30 at 19:53, Harry Ohlsen wrote:
> > Hi Tom,
> > 
> > Sorry, I don't have an answer to your question. I had a quick play with this some time back and didn't get anywhere.
> > 
> > If you get the code to work under Windows, can you post the final version to the mailing list?
> > 
> > Cheers,
> > 
> > Harry O.
> 
> Sure, I'll post any working code I get, but I'm a bit discouraged by my
> further research:
> 
> <http://www.escribe.com/software/foxusers/m4610.html>
> 
> According to this, on Windows, Fox does DND in it's own way, not
> Window's way, because OLE is too weird to be cross-platform. 
> Unfortunately, Windows developers, and certainly Microsoft, won't jump
> to change their DND to work with Fox.
> 
> <http://www.escribe.com/software/foxusers/m4066.html>
> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/legacyinformation/shelllib.asp>
> 
> However, while most of Windows uses OLE or COM or some other hip TLA,
> there's also a special API for file dropping, and this person hacked up
> a way to do this in C++.  This can be done in plain Ruby and FXRuby,
> given the ability:
> 
>  - To call Windows functions (Yes)
>  - To access a given FXWindow's handle (Maybe)
>  - To intercept the WM_DROPFILES message and extract wParam (Maybe)
>  - To work with pointers to pre-allocated buffers.  (Yes)
> 
> I might be able to hack this up tomorrow, if FXRuby and Fox let me get
> low enough access.  I know it's possible in C++, but I can only hope
> FXRuby exports enough to intercept messages and get handles.
> 
> If I were a Fox hacker, I'd say they should use this simpler API to
> emulate Fox's DND, by sending synthetic messages and making it look like
> "text/uri-list".

I've looked into this further, and I don't think FXRuby gives low-level
enough access to do this in Ruby.  It would be possible for FXRuby to
expose FXApp::dispatchEvent() and FXRawEvent and the window handle, so
it could implemented in Ruby, or for FXRuby to generate fake drag events
itself, but I don't think Ruby or FXRuby is the right place for this.  

To this end, I've suggested on the foxgui-users list that FOX itself
should synthesize the drop of a "text/uri-list" when it gets a
WM_DROPFILES.

If they do that, it should make my original code work, in Windows as it
does in Linux.

Have fun,
-- 
Tom Felker <tcfelker / mtco.com>