0

I am using the following line

SetForegroundWindow(hWnd);  

in c++ to get focus to an ie8 window. What actually happens is , i get focus for 2 times and after that if i open the next time instead of getting the focus, it just blinks in the taskbar in orange colour. Please provide me a resolution for this. Any alternative for SetForegroundWindow()? I have tried using

SendMessage(hWnd, WM_SYSCOMMAND, SW_SHOW,0);

It did not work.

IInspectable
  • 46,945
  • 8
  • 85
  • 181
Vicky
  • 37
  • 2
  • 2
  • 7
  • This thread seems to cover it. http://stackoverflow.com/questions/3772233/win32-setforegroundwindow-unreliable –  Mar 29 '13 at 01:10
  • The documentation for [`SetForegroundWindow`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms633539.aspx) explains under which conditions this API call can be used. This answers one of your questions. – IInspectable Aug 02 '13 at 15:24

1 Answers1

0

Try this:

ShowWindow(hWnd,SW_SHOWMAXIMIZED);
rohitvk
  • 277
  • 3
  • 13