From: Wayne Vucenic Date: 2003-09-28T14:08:42+09:00 Subject: RubyDotNet and Drag and Drop I just heard about RubyDotNet, and it looks really great! I did encounter a problem while trying to use drag and drop. (RubyDotNet r4, Ruby 1.8, .NET 1.1, Windows XP). Here's a stripped down piece of code that demonstrates the problem: require 'dotnet' loadLibrary 'System.Windows.Forms' form = Form.new form.topMost = true form.text = 'Drag and Drop Test' form.AllowDrop = true; Application.Run form When I run this I get a "Microsoft .NET Framework" dialog saying "An unhandled exception has occurred in your application...DragDrop registration failed" with the following details: ************** Exception Text ************** System.InvalidOperationException: DragDrop registration failed. ---> System.Threading.ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept) --- End of inner exception stack trace --- at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept) at System.Windows.Forms.Control.OnHandleCreated(EventArgs e) at System.Windows.Forms.Form.OnHandleCreated(EventArgs e) at System.Windows.Forms.Control.WmCreate(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmCreate(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) Thanks!!! Wayne No Bugs Software "Ruby and C++ Contract Programming in Silicon Valley"