Hi,
Thank you for your reply.
The reason I need to open if from a new thread, is that my application is
plugin-enabled. When the user loads/enables a plugin, my application calls
the "SetUp()" function on the plugin - and this might envolve ask the user
to select a folder, show a windows form, and so on.
A workaround would be to call this function from within my program (ie
without actually opening a new thread)... But in the meantime I'll try to
solve this, if only to gain new knowledge :-)
I ended up doing what the message says and it did work, but now I get this
error message:
The CLR has been unable to transition from COM context 0x1b07f8 to COM
context 0x1b0a20 for 60 seconds. The thread that owns the destination
context/apartment is most likely either doing a non pumping wait or
processing a very long running operation without pumping Windows messages.
This situation generally has a negative performance impact and may even lead
to the application becoming non responsive or memory usage accumulating
continually over time. To avoid this problem, all single threaded apartment
(STA) threads should use pumping wait primitives (such as
CoWaitForMultipleHandles) and routinely pump messages during long running
operations.
I tried to Google it, but couldn't find anything I could use. I'll try to
search a bit more before I change my code to call the setup() function
before creating a thread...
Andre Nogueira
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:ea****************@TK2MSFTNGP10.phx.gbl...
Andre,
I'd like to be able to open a FolderBrowser instance from within a thread
I
lauched
Why?
So... Is there any way I can accomplish this, or do I have to think of
another way?
It can certainly be done but you have to make the thread to run in STA
like the message says, bu setting its ApartmentState property.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.