Steve N. wrote:
Whats the best way to access .net GUI classes from a spawned thread?
Is this even advisable, or is it a sign that the design is wrong?
The design is not wrong, but you jmust be careful to make your GUI API
thread-safe : each public function of your GUI objects that may be called on
different threads should begin by something like this (in C# for ease of
syntax, but you've got the idea) :
delegate void DoSomethingDelegate(params...) ///DoSomethingDelegate matches
DoSomething'signature
void DoSomething(params....)
{
if (InvokeRequired)
{
BeginInvoke (new DoSomethingDelegate(DoSomething, new object[]
{params...}));
return;
}
//normal GUI stuff
}
Arnaud
MVP - VC