Index   Commented   Search   About

Stretching an Image and Window

The following example stretches the images of a video clip and changes the aspect ratio of the displayed frames. The frames displayed in the MCIWnd window are twice the height and three times the width of the original frame. The MCIWndGetDest and MCIWndPutDest macros retrieve and redefine the destination rectangle coordinates. The GetWindowRect and SetWindowPos functions manage changes to the MCIWnd window dimensions.

// 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.

Related Links

Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference (win32.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008 Free Tect Secrets ;) greatis just4fun network just4fun