hresult hr = g_pwc->getnativevideosize(&lwidth, &lheight, null, null);
if (succeeded(hr))
{
rect rcsrc, rcdest;
// set the source rectangle.
setrect(&rcsrc, 0, 0, lwidth/2, lheight/2);
// get the window client area.
getclientrect(hwnd, &rcdest);
// set the destination rectangle.
setrect(&rcdest, 0, 0, rcdest.right/2, rcdest.bottom/2);
// set the video position.
hr = g_pwc->setvideoposition(&rcsrc, &rcdest);
}
处理窗口消息
因为vmr没有自己的窗口,所以当视频需要重画或者改变的时候你要通知它。
1 当你接到一个wm_paint消息,你就要调用ivmrwindowlesscontrol::repaintvideo来重画视频