#!/usr/local/bin/perl -w

use strict;

use Win32::GUI;
use Win32::GUI::DragDrop;



	#Also works for Window objects
my $winMain = new Win32::GUI::DialogBox(
      -left   => 700,
      -top    => 50,
      -width  => 100,
      -height => 100,
      -name   => "winMain",
      -text   => "",
      );

	#Can drop on top of buttons
$winMain->AddButton(
		-text    => "F",
		-name    => "btnTest",
		-left    => 0,
		-top     => 0,
		-width   => 20,
		-height  => 20,
	    );

	#Can drop on top of RichEdit (will "land" on window)
$winMain->AddRichEdit(
		-text    => "Drop files here",
		-name    => "reTest",
		-left    => 0,
		-top     => 23,
		-width   => 90,
		-height  => 50,
	    );


print "Initial state   : accepts drops: " . $winMain->DragAcceptFiles() . "\n";

$winMain->DragAcceptFiles(1);
print "After accept    : accepts drops: " . $winMain->DragAcceptFiles() . "\n";

$winMain->DragAcceptFiles(0);
print "After not accept: accepts drops: " . $winMain->DragAcceptFiles() . "\n";

$winMain->DragAcceptFiles(1);
print "After accept    : accepts drops: " . $winMain->DragAcceptFiles() . "\n";
print "\n\n";


$winMain->Show();
Win32::GUI::Dialog();



sub winMain_Terminate {
	return(-1);
	}


sub winMain_DropFiles {
	my ($handleDrop) = @_;
	
	print join("\n", Win32::GUI::DragDrop::GetDroppedFiles($handleDrop)) . "\n\n";
	
	return(1);
	}



#EOF
