Alistair,
Well, it is the cause, but it's supposed to be there. It's a
fundamental windows programming tennant that you have to make calls to UI
components on the same thread that they were created. You are looking to
activate your form, so that call has to be made on the main thread.
If you remove that attribute, your program is going to stop working in a
number of other places really quick.
Now, there is no reason you can't get the cursor position and expose
those details to the worker thread, and then call Invoke to call a delegate
that will call Activate on your form when done.
Of course, I still don't see why you have to, as the code you have is
very small, and shouldn't take long to run at all.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>> Alistair,
>>
[quoted text clipped - 12 lines]
> Application.Run(f1);
> }
Alistair George - 12 Oct 2007 03:26 GMT
> Alistair,
Invoke to call a delegate
> that will call Activate on your form when done.
>
> Of course, I still don't see why you have to, as the code you have is
> very small, and shouldn't take long to run at all.
Cheers Nicholas. Your help appreciated. I am quite clueless when it
comes to this part of programming never having been there before. C# is
much more picky than Delphi used to be, but I can figure its for stability.
Am trying to get the middle mouse button to activate a form, as well as
hotkey combo (which is working well). Catching the middle mouse button,
but from there the problem area is.
An alternative could be to simulate a hotkey press to activate the form.