拉伸图像和窗口
以下示例拉伸视频剪辑的图像并更改所显示帧的纵横比。 MCIWnd 窗口中显示的帧高度是原始框架的两倍,宽度是原始框架的三倍。 MCIWndGetDest 和 MCIWndPutDest 宏检索并重新定义目标矩形坐标。 GetWindowRect 和 SetWindowPos 函数管理对 MCIWnd 窗口维度的更改。
// extern RECT rCurrent, rDest;
case WM_COMMAND:
switch (wParam)
{
case IDM_CREATEMCIWND:
g_hwndMCIWnd = MCIWndCreate(hwnd,
g_hinst,
WS_CHILD | WS_VISIBLE,
"sample.avi");
break;
case IDM_RESIZEWINDOW: // destination RECT and playback area
GetWindowRect(g_hwndMCIWnd, &rWin); // window size
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rDest.top = rCurrent.top; // new boundaries
rDest.right = rCurrent.right;
rDest.left = rCurrent.left +
((rCurrent.left - rCurrent.right) * 3);
rDest.bottom = rCurrent.top +
((rCurrent.bottom - rCurrent.top) * 2);
MCIWndPutDest(g_hwndMCIWnd, &rDest); // new RECT
SetWindowPos(g_hwndMCIWnd, // window to resize
NULL, // z-order: don't care
0, 0, // position: don't care
rDest.right - rDest.left, // width
(rWin.bottom - rWin.top + // height (window -
(rCurrent.bottom - rCurrent.top) + // original RECT +
(rDest.bottom - rDest.top)), // new RECT
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
break;
}
break;
// Handle other messages here.