0

I have an UI that can go to full screen. When going to full screen I'm calling the sequence below:

ShowWindow(hwnd, SW_HIDE);
SetWindowRgn(hwnd, NULL, TRUE);
SetWindowPos(hwnd, 0, left, top, right, bottom, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER)) ;
ShowWindow(hwnd, SW_SHOW);

I'm having a bug that the window first being displayed in the upper left corner with the previous size and only then goes to full screen size. I suspect that this may be becauseSetWindowRgn() call is async. and actually being executed after ShowWindow(). I know from documentation that all other calls are blocking, but, there is no comment about SetWindowRgn() whether it is blocking or not. How can I be sure about it? Thanks.

Sanich
  • 1,739
  • 6
  • 25
  • 43
  • Could it be that you are observing a delay in painting of your window? When you resize it, windows moves existing bits to a new location and invalidates the newly added area. You could try to add SWP_NOCOPYBITS flag to your SetWindowPos() call. Or you could resize your window to an off-screen position, update it and move back in. – Vlad Feinstein Aug 10 '15 at 15:50

1 Answers1

1

Is SetWindowRgn blocking?

Yes. This function, like all called in the code in the question, is synchronous.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490