[與此頁面相關聯的功能,MCIWnd 視窗類別是舊版功能。 MediaPlayer已取代它。 MediaPlayer 已針對 Windows 10 和 Windows 11 優化。 Microsoft強烈建議新程式代碼盡可能使用 MediaPlayer,而不是 MCIWnd Window 類別。 Microsoft建議使用舊版 API 的現有程式代碼,盡可能改寫成使用新的 API。]
下列範例會延展影片剪輯的影像。 它會使用 MCIWndPutDest 巨集來增加目標矩形的維度。 播放區域的大小保持不變,因此結果是扭曲的放大影像。 這些範例會使用 MCIWndPutDest 函式,在播放區域方面重新置放目的地矩形,提供檢視延伸影像不同部分的方法。
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_STRETCHIMAGE: // stretch destination RECT 3:2,
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 destination
break;
case IDM_MOVEDOWN: // move toward bottom of image
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rCurrent.top -= 100; // new boundaries
rCurrent.bottom -= 100;
MCIWndPutDest(g_hwndMCIWnd, &rCurrent); // new destination
break;
case IDM_MOVEUP: // move toward top of image
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rCurrent.top += 100; // new boundaries
rCurrent.bottom += 100;
MCIWndPutDest(g_hwndMCIWnd, &rCurrent); // new destination
break;
case IDM_MOVELEFT: // move toward left edge of image
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rCurrent.right += 100; // new boundaries
rCurrent.left += 100;
MCIWndPutDest(g_hwndMCIWnd, &rCurrent); // new destination
break;
case IDM_MOVERIGHT: // move toward right edge of image
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rCurrent.right -= 100; // new boundaries
rCurrent.left -= 100;
MCIWndPutDest(g_hwndMCIWnd, &rCurrent); // new destination
break;
}
break;
// Handle other messages here.