C# - bring winform application window to the front?

Tom Knowlton
Tom Knowlton used Ask the Experts™
on
Is there a way to programmatically make my application be the "front" window.

My question would apply equally to if it is minimized as well as if it is not minimized or is partially behind another window.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
[DllImport("user32.dll")]
private static extern int ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
private static extern int SetForegroundWindow(IntPtr hWnd);

ShowWindow(hWnd, 1);
SetForegroundWindow(hWnd);

here:
http://www.experts-exchange.com/blogs/systan/B_3773-Openning-application-only-once.html

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial