none
[MTAThreadAttribute] and [STAThreadAttribute]

    Dotaz

  • Hello,

    I have a small problem. I have project in MV VS C++/CLI 2012, Win7x64, 64bit application. If I use [STAThreadAttribute]  everything goes well, but if I use [MTAThreadAttribute], I get this error:

    DragDrop registration did not succeed.

    http://uloz.to/xrcTtit7/problem-jpg

    How can I repair this problem.

    Jerry

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.InvalidOperationException: DragDrop registration did not succeed. ---> System.Threading.ThreadStateException: Current thread must be 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.ToolStripDropTargetManager.SetAcceptDrops(Boolean accept)
       --- End of inner exception stack trace ---
       at System.Windows.Forms.ToolStripDropTargetManager.SetAcceptDrops(Boolean accept)
       at System.Windows.Forms.ToolStrip.OnHandleCreated(EventArgs e)
       at System.Windows.Forms.Control.WmCreate(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
    ----------------------------------------
    ROBOMAP
        Assembly Version: 1.0.4891.37617
        Win32 Version:
        CodeBase: file:///C:/_MSVS/CLRW6/x64/Release/ROBOMAP.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.

    čtvrtek 23. května 2013 20:04