views:

282

answers:

4

Is there a correct way in Windows Forms to flash a titlebar without having to drop to P/Invoking FlashWindow?

I'm using .NET 2.0 for compatibility and size reasons, so maybe I just missed the method because it's in newer versions of the .NET framework.

+3  A: 

No, I dont think so. PInvoking the FlashWindowEx method is the only way I think.

Rune Grimstad
+2  A: 

MSDN: System.Windows.Form.Activate()

Activating a form brings it to the front if this is the active application, or it flashes the window caption if this is not the active application. The form must be visible for this method to have any effect.

Supported in: 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0

DrJokepu
A: 

@DrJokepu:

The .Activate() method, in 2.0, also brings the window to the front despite what the documentation says (i.e. other applications that are in front lose focus). Just tried this.

This is unfortunately exactly what I was trying to avoid.

millenomi
A: 

If you do find a ".NET" way of doing it, it will probably call p/invoke under the covers anyways.

This isn't Java, you don't have to be afraid of the operating system.

Jonathan Allen