I've created COM server using C# where my clients can receive real time updates. Updates usually fired from different threads. But I've noted that Excel crashes when callback methods updates spreadsheet. Is there any way to call updates in UI thread?
P.S. I know about RTD feature of Excel. But it doesn't suit my needs because i need several parameters in one update.
what you are looking for is the Invoke / BeginInvoke Method of ISyncronizedInvoke
on your UI thread, take an arbitrary control and keep that reference ...
from the thread that wants to fire an update, call Invoke or BeginInvoke on that control (Control implements ISyncronizedInvoke) with a delegate that you want to execute on the UI thread ... from that delegate you may call your COM server
//EDIT: example code
be advised: this example does not clean up the wrkSheet reference and the ExApp reference ... you have to release them before you exit your application