How to bring a window foreground using c#?
I am trying to bring a window foreground. I am using this code. But its not working. Could someone please help? ShowWindowAsync(wnd.hWnd, SW_SHOW); SetForegroundWindow(wnd.hWnd); // Code from Karl E. Peterson, www.mvps.org/vb/sample.htm // Converted to Delphi by Ray Lischner // Published in The Delphi Magazine 55, page 16 // Converted to C# by Kevin Gale IntPtr foregroundWindow = GetForegroundWindow(); IntPtr Dummy = IntPtr.Zero; uint foregroundThreadId = GetWindowThreadProcessId(foregroundWindow, Dummy); uint thisThreadId = GetWindowThreadProcessId(wnd.hWnd, Dummy); if (AttachThreadInput