Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MCI, playing an AVI, using my own window

Posted on 1997-05-08
1
Medium Priority
?
470 Views
Last Modified: 2013-12-04
I am using the Media Control Interface to play an AVI file.  I can easily open, play and close the AVI file.  By default the video plays in it's own window that is created on play.

This is all fine--but unfortunately I want to play the AVI file within my own window.  To do this, I have done the following after issuing the open command:

  MCI_DGV_WINDOW_PARMS params;
  params.hWnd = wnd.m_hWnd;
  if (mciSendCommand(m_OpenParams.wDeviceID,
                       MCI_WINDOW,
                       MCI_DGV_WINDOW_HWND,
                       (unsigned long)&params) != 0)
  {
    return FALSE; // some error
  }

This works... well sort of.  When the video initially displays, it appears fine.  But as soon as it begins to play, the video appears garbled.

My guess is I might need to handle screen updates or something.  Unfortunately I can't find any documentation or samples for this.

Thanks in advance.

0
Comment
Question by:BrindleFly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 300 total points
ID: 1397178
When you say it appears garbled, does it mean the color of the video changes or the image changes or something else? Do you have your own color palette operation in your window? My program plays AVI files in my own window fine. I don't think you need to handle screen updates.

The following code was extracted from Video For Windows 1.1 Programmer's Guide.

The following fragment finds the dimensions needed to play an AVI file, creates a window corresponding to that size, and has MCIAVI to play the file in the window:

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.
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);

}


The following fragment shows how to display the window using the command message interface:

MCI_DGV_WINDOW_PARMS    mciWindow;

mciWindow.nCmdShow = SW_SHOW;    // set command - see ShowWindow()
mciSendCommand(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_STATE,
               (DWORD)(LPSTR)&mciWindow);

0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question