Solved

MCI, playing an AVI, using my own window

Posted on 1997-05-08
1
437 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 100 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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

736 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