Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent control from stealing focus?

We have a 3rd party control loaded in our C# WinForms app.

When we call a method on this 3rd party ActiveX control, it asynchronously steals focus. For example:

// This call causes 3rd party to spawn a thread and steal focus 
// milliseconds later.
foo3rdParty.DoSomething();

Is there a way to prevent a control from stealing focus?

like image 685
Judah Gabriel Himango Avatar asked Dec 29 '22 19:12

Judah Gabriel Himango


1 Answers

If this evil little control isn't meant to be visible, you could place it on an invisible form and call DoSomething() on it there. Then, who cares if it grabs the focus?

like image 174
MusiGenesis Avatar answered Jan 07 '23 04:01

MusiGenesis