다음을 통해 공유


이미지 및 창 늘이기

[MCIWnd Window 클래스 이 페이지와 연결된 기능은 레거시 기능입니다. MediaPlayer가로 대체되었습니다. MediaPlayer Windows 10 및 Windows 11에 최적화되었습니다. 가능한 경우 새 코드에서 MCIWnd Window 클래스 대신 MediaPlayer 사용하는 것이 좋습니다. 가능한 경우 레거시 API를 사용하는 기존 코드를 다시 작성하여 새 API를 사용하도록 제안합니다.]

다음 예제에서는 비디오 클립의 이미지를 늘이고 표시된 프레임의 가로 세로 비율을 변경합니다. MCIWnd 창에 표시되는 프레임은 높이의 두 배, 원래 프레임 너비의 3배입니다. MCIWndGetDestMCIWndPutDest 매크로는 대상 사각형 좌표를 검색하고 다시 정의합니다. GetWindowRectSetWindowPos 함수는 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.