0

I'm running into a problem where, I have a Window that contains a child window. The child window contains another child window where a video is playing using Windows Media Player. Whenever I do call ShowWindow (hWnd, SW_HIDE) on the parent Window and paint over the entire surface, the region occupied by the grand-child window (where the video was playing) is not overridden. I used spy++ and found that that region which was not overridden was set to hidden BEFORE the repaint occurs.

I monitored the hwnd of the grand-child window and it did not seem to receive any WM_EraseBKGND or WM_NCPAINT messages. Does this mean the area it occupied had not been invalidated and therefore could not be drawn over? I'm new to winforms.

Thanks!

wk1989
  • 611
  • 1
  • 8
  • 19
  • 1
    The video window is probably utilizing a technology such as DirectX which bypasses the usual Windows API for screen updates. Unfortunately I don't know how to help you - I'd expect the child window to detect that it was hidden and to disable the grandchild automatically. – Mark Ransom Apr 14 '10 at 18:26
  • After some investigation I believe DirectX is the problem, I turned desktop composition off (I'm using Vista) and this problem does not occur. Also, if I hide the window while the video is playing (instead of stopping and hiding) the problem also does not occur. – wk1989 Apr 14 '10 at 19:32
  • The problem seems to be with Vista's EVR video renderer, the region it occupies doesn't seem to be painted over if the video that is rendering is stopped. – wk1989 Apr 15 '10 at 21:21

1 Answers1

1

Very unclear, I have to assume that when you hide the parent window then nothing will be visible. One thing that might be relevant is that video is always displayed in a hardware overlay. That's a feature of the video adapter, it can overlay different chunks of video memory to produce a composite image. Accordingly, if you hide that video window, the parent of that window will not get a repaint message because it wasn't actually overlapped.

Use the Invalidate() method to force windows to repaint themselves. Avoid P/Invoking ShowWindow() if you can, the Visible property is always a good alternative.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536