Wohoo! I got it to work! :)
It took some XS hacking though. Nothing fancy, mostly copy-paste and common
sense.
I added the WM_DROPFILES message to the WindowMsgLoop so that it throws an
event DropFiles() with the drop handle in question.
And once in Perl it was piece a cake to call the shell32.dll functions
DragQueryFile and DragFinish to actually get the files. Cool. This is fun!
Some code:
GUI.xs, line 1839:
----------
case WM_DROPFILES:
if(GetObjectName(NOTXSCALL hwnd, Name)) {
/*
* (@)EVENT:DropFiles(DROP_HANDLE)
* Sent when the window receives dropped files.
* (@)APPLIES_TO:Window, DialogBox
*/
strcat(Name, "_DropFiles");
PerlResult = DoEvent_Long(NOTXSCALL Name, UINT(wParam));
}
break;
----------
http://www.bahnhof.se/~johanl/perl/Win32GUI/
- AdHoc.pm
Perl subs for dealing with the shell32.dll calls handling the drop
operation (among other things).
- dragdrop.pl
Working demo program (if you rebuild the XS code). The actual drag-drop
code is this simple in a Perl application:
----------
Win32::GUI::AdHoc::windowDragAcceptFiles($winMain, 1);
sub winMain_DropFiles {
my ($handleDrop) = @_;
print join("\n", Win32::GUI::AdHoc::windowGetDroppedFiles($handleDrop)) .
"\n\n";
return(1);
}
----------
I guess a more complete solution would include drag-drop to e.g. a RichEdit
or Textfield control etc. but I'm not sure what the implications are.
I'm not sure how to continue with this. For my personal use, I'm probably
gonna create a Win32::GUI::DragDrop module or something (using my XS mod),
but maybe this belongs in the next release of Win32::GUI after a code
review (after all, I relly don't _know_ these things). Aldo?
/J
--
Johan Lindström, Sourcerer, Boss Casinos Ltd, Antigua
[EMAIL PROTECTED]