Books

miércoles, 6 de octubre de 2010

Win32 SetForegroundWindow equivalent in C# / .NET

Many Win32 programmers find dificult to find the equivalent of Win32 API Functions

As result of that, they don't find the right equivalent and try to use the API by loading a dll and finding the desired function or even worse they do ugly alternative things instead of using the right .NET function.


Here is the SetForegroundWindow equivalent:

form.Activate();

I have seen people doing weird things like:
this.TopMost = true;
this.Focus();

this.BringToFront();

this.TopMost = false;

1 comentario:

Dan Dar3 dijo...

That's exactly what I needed to bring my form in foreground after dragging and dropping files from Explorer, thanks!