A
Alistair George
if (e.Clicks > 0 && e.Button == MouseButtons.Middle)
{
f1.NewThread = new Thread(new
ThreadStart(f1.ShowMainNodes));
f1.NewThread.Start();
}
private void ShowMainNodes()
{
API.POINTAPI papi = new ALaunch.API.POINTAPI();
API.GetCursorPos(ref papi);
Point p = new Point(papi.x /*- this.Location.X*/ , papi.y
/*- this.Location.Y - 16*/);
this.Activate(); // x-thread error here - why; I thought
this was done in a thread-safe manner?
}
Thank you.
//System.InvalidOperationException was unhandled
Message="Cross-thread operation not valid: Control 'Form1' accessed
from a thread other than the thread it was created on."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Form.Activate()
at ALaunch.Form1.ShowMainNodes() in C:\Documents and
Settings\Alistair George\My Documents\Visual Studio
2005\Projects\Launcher\Form1.cs:line 335
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
{
f1.NewThread = new Thread(new
ThreadStart(f1.ShowMainNodes));
f1.NewThread.Start();
}
private void ShowMainNodes()
{
API.POINTAPI papi = new ALaunch.API.POINTAPI();
API.GetCursorPos(ref papi);
Point p = new Point(papi.x /*- this.Location.X*/ , papi.y
/*- this.Location.Y - 16*/);
this.Activate(); // x-thread error here - why; I thought
this was done in a thread-safe manner?
}
Thank you.
//System.InvalidOperationException was unhandled
Message="Cross-thread operation not valid: Control 'Form1' accessed
from a thread other than the thread it was created on."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Form.Activate()
at ALaunch.Form1.ShowMainNodes() in C:\Documents and
Settings\Alistair George\My Documents\Visual Studio
2005\Projects\Launcher\Form1.cs:line 335
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()