DBW,
You can not run code outside of a thread. There is always a thread that
is executing your code. Chances are you mean outside of the UI thread.
When you create the new thread, set the apartment state of the thread to STA
and it will probably work. You have to make sure you set the ApartmentState
property before any interop calls are made.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"DBW" <DB*@discussions.microsoft.com> wrote in message
news:A5**********************************@microsof t.com...
I am using a com server to return a memory pointer to a C# program in .net.
The code works fine when it is not in a thread. When it is run in a thread
the pointer no longer points to the data the com server has.
I am using a System.IntPtr to transfer the pointer.
Are there marshaling issues?
When you look at the memory in the debugger it appears to be garbage.
What other things do I need to consider when doing this?