I've an app that have been written in vs 2003, today I convert it to vs 2005 but when I want to run this program (in debug mode or not) this exception occurred.
Ex.Message: "DragDrop registration did not succeed."
What's wrong in my app that cause this exception

strange excepstion
mcoulton
wpvanv
Nice, it actually works!!!
Peter D. Falco Jr.
I have been searching to find an answer on this same question and I just did.
I read: http://blogs.msdn.com/adam_nathan/archive/2003/07/18/56727.aspx
and this gave me a clue.
To solve my problem, I went into the
Project Properties->Configuration Properties->Linker->Advanced
and set CLR Thread Attribute to -> STA Threading.
I thought this was already set by looking at my Form1.cpp file which had STA threading set.
Hope this helps.
Clark
espenhjo
Has anyone face this exception
Josh Korn at Diligentsia
Deutschland vor!
1. at starting,
using System.Net;
2. Just before Main()
[STAThread]
static void Main()
Enjoy,
Jeremy Riley
Please do the following,
1) include the following
using System.Net;
using System.Threading;
2) add the [STAThread] Attribute just before ur main function and also remember to inlcude using System.Net; in ur main program,
[STAThread]
static void Main()
3) The steps are as follows for threading,
1. Put all the code ( for which u r getting this exception) in one function say function A. In the function B in which u are calling ur code,do the following,
function B
{
Thread t = new Thread(new ThreadStart(A));
t.SetApartmentState(ApartmentState.STA);
t.Start( );
}
function A
{
the code of Windows form..or whatever which is causing the error
}
Explanation:
It turns out that WF when executing all of its pretty pictures creates a thread to run each of those pictures with. These threads are in MTA mode (multi threaded apartments) and thus, in .Net 2.0 cannot be used for forms with drag and drop. so, any code which has AllowDrop Property true will give this error. With this came the following solution. All of the code used to create the form was placed in a single static function. The parent function, when it desires to call a new form ( windows form) , creates a thread, in STA mode, to execute this function. Thus the following code goes in the parent function
Thread t = new Thread(new ThreadStart(FormFunction));
t.SetApartmentState(ApartmentState.STA);
t.Start( );
I hope this will help.
Enjoy,
Sneha