You can do this in the DragDrop event handler of your control:
[C#]
using System.IO;
try
{
// Use e.Data.GetData("UniformResourceLocator") to get the URL
byte[] contents = new Byte[ 512 ];
Stream ioStream= (Stream) e.Data.GetData( "FileGroupDescriptor" );
ioStream.Read( contents, 0, 512 );
ioStream.Close();
StringBuilder sb = new StringBuilder();
// The magic number 76 is the size of that part of the
// FILEGROUPDESCRIPTOR structure before the filename starts
for ( int i = 76; contents[ i ] != 0; ++i )
sb.Append( (char) contents[ i ] );
if ( !sb.ToString( sb.Length-4, 4 ).Equals( ".url" ) )
throw new Exception("filename does not end in '.url'");
filename = sb.ToString( 0, sb.Length-4 );
}
catch ( Exception ex )
{
MessageBox.Show( ex.ToString() );
}
Andy Fish and Brian