Moving a DirectShow window while paused
I’ve been writing a lot of DirectX / DirectShow stuff lately and I’ve come across a problem if I pause a video replay and then move the containing window. The playback window becomes separated from the containing window even though I am handling the WM_MOVE event.
You’d think that the following code would work:
void CMyWindow::OnMove()
{
CRect r;
GetClientRect(r);
// _piWindow is a pointer to my filtergraph's IVideoWindow interface.
_piWindow->SetWindowPosition(r.left, r.top, r.Width(), r.Height());
}
It works fine if the video is playing but if the replay is paused, the active movie window will ignore the window move commands.
The solution was to trick DirectShow into thinking that you want to resize the window like so:
void CMyWindow::OnMove()
{
CRect r;
GetClientRect(r);
_piWindow->SetWindowPosition(r.left, r.top, r.Width() + 4, r.Height());
_piWindow->SetWindowPosition(r.left, r.top, r.Width(), r.Height());
}
