To make that clearer. I mean't that the [STAThread] attribute means that OleInitialize will be called (some may have assumed it would force a call to CoInitialize). Absence of this attribute will cause CoInitializeEx(NULL, COINIT_MULTITHREADED); to be called. Obviously these calls only happen if the thread performs any COM Interop
Richard http://staff.develop.com/richardb -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of Richard Blewett Sent: 21 May 2002 11:31 To: [EMAIL PROTECTED] Subject: Re: [DOTNET] STAThread and Clipboard/DnD/CommonDialog The [STAThread] attribute ensures that the thread calls OleInitialize not CoInitialize. OleInitialize sets up the extra stuff required for OLE Drag and Drop, etc. Richard http://staff.develop.com/richardb -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of Richard Birkby Sent: 21 May 2002 11:13 To: [EMAIL PROTECTED] Subject: [DOTNET] STAThread and Clipboard/DnD/CommonDialog Why does a thread have to be marked as an STAThread when it's calling operations on the clipboard? Why can't COM marshal the calls from the (default) MTA to the STA required by the clipboard? Richard You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.