[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-swt-dev] Multi-threading and OleInitialize
|
I'm building an application that runs several UIs under different threads.
Some of these threads connect to automation servers (like Outlook) and
custom ActiveX controls using SWT's COM API.
When creating a DropTarget in one of my threads I get:
"Cannot initialize Drop result = -2147221008"
-2147221008 turns out to be "CoInitialize not called" error. My workaround
is to call "org.eclipse.swt.internal.win32.OS.OleInitialize(0);" at the
beginning of the thread and "OS.OleUninitialize();" at the end.
I noticed that org.eclipse.swt.internal.ole.win32.COM has a static
"OS.OleInitialize(0)" call, so it looks like the first thread gets the
initialize and no other.
Is my solution safe? Is there a better way? Through trial and error I'm
avoiding SWTErrors by synching to display threads and praying I don't hit a
thread lock.
Comments, anybody?
My project may be rather ambitious, but so far SWT is working out very well!
-Erik