Index   Commented   Search   About

Setting Up the Playback Window

The following example finds the dimensions needed to play an AVI file, creates a window corresponding to that size, and plays the file in the window by using the MCIAVI driver.

HWND hwnd;

MCI_DGV_RECT_PARMS mciRect;

// Get the movie dimensions with MCI_WHERE.

mciSendCommand(wDeviceID, MCI_WHERE, MCI_DGV_WHERE_SOURCE,

(DWORD)(LPSTR)&mciRect);

// Create the playback window. Make it bigger for the border.

// Note that the right and bottom members of RECT structures in MCI

// are unusual; rc.right is set to the rectangle's width, and

// rc.bottom is set to the rectangle's height.

hwndMovie = CreateWindow("mywindow", "Playback",

WS_CHILD|WS_BORDER, 0,0,

mciRect.rc.right+(2*GetSystemMetric(SM_CXBORDER)),

mciRect.rc.bottom+(2*GetSystemMetric(SM_CYBORDER)),

hwndParent, hInstApp, NULL);

if (hwndMovie){

// Window created OK; make it the playback window.

MCI_DGV_WINDOW_PARMS mciWindow;

mciWindow.hWnd = hwndMovie;

mciSendCommand(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_HWND,

(DWORD)(LPSTR)&mciWindow);

}

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