Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top