[IronPython] Problem: AllowDrop = True --> DragDrop registrationfailed

John Lam jlam at iunknown.com
Fri Nov 18 03:24:35 CET 2005

MTA is default due to a change in the behavior of the Whidbey CLR. 


In earlier versions of the CLR, CoInitializeEx was not called in *most*
cases. So you could tell your thread to enter an STA via a change to
ApartmentState in *most* cases. The default in Whidbey is to put all
threads in the MTA which is more predictable, even at the expense of
breaking applications that manually set the ApartmentState of a thread
after execution has started.


You must declare the COM requirements of the startup thread via an
STAThread attribute in your application's Main() method. I'm not sure
how attributes are supported in IP (I've run into this problem in my
Ruby bridge - and have a non-ideal solution to it as well).




http://www.iunknown.com <http://www.iunknown.com/> 




From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of J. de Hooge
Sent: Thursday, November 17, 2005 9:00 PM
To: users at lists.ironpython.com
Subject: [IronPython] Problem: AllowDrop = True --> DragDrop




In the past months I've been coding quite extensively using previous
versions of IronPython (upto 0.9.3) and the .NET 2.0 framework beta.

One of the things I've been using a lot is drag&drop.


Recently I've downloaded IP 0.9.5 and the "final" .NET 2.0 distribution.

Setting the AllowDrop property of e.g. a Forms.ListView to True now
results in an exception message: DragDrop registration failed.


>From the internet I've gathered that I should change the ApartmentState
of my main thread to STA, using an attribute.

But how can I do that from IP? And why is MTA the default, causing this


Or is there a different solution.

Any help appreciated.



Jacques de Hooge

info at geatec.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20051117/53eb3b9a/attachment.html>

More information about the Ironpython-users mailing list