Jump to content

MCI_WINDOW

From EDM2

This message specifies the window and characteristics that a graphic device (such as digital video or video overlay) should use for its display.

Syntax

param1
ULONG ulParam1; /* Message flags. */

param2
PMCI_VID_WINDOW_PARMS pParam2; /* Pointer to window structure. */

Parameters

ulParam1 (ULONG) - input
This parameter can contain any of the following flags:
* MCI_NOTIFY — Posts a notification message when the action completes.
* MCI_WAIT — Does not return control until the action completes.
Digital Video Extensions
* MCI_DGV_MONITOR — Applies the message functions to the monitor window.
* MCI_DGV_WINDOW_HWND — Uses the handle in `hwndDest` as the destination window.
* MCI_DGV_WINDOW_DEFAULT — Switches back to the default video window.
* MCI_DGV_WINDOW_STATE — Uses the `usCmdShow` field to set window state (e.g., `SWP_SHOW`, `SWP_HIDE`). Only applies to the default window.
* MCI_DGV_WINDOW_TEXT — Uses the `pszText` field to set the window caption. Only applies to the default window.
Video Overlay Extensions
* MCI_OVLY_WINDOW_DEFAULT — Uses the default video window.
* MCI_OVLY_WINDOW_HWND — Uses the handle in `hwndDest` as the destination window.
* MCI_OVLY_WINDOW_STATE — Sets the window state using `usCmdShow`. Only applies to the default window.
* MCI_OVLY_WINDOW_TEXT — Sets the window caption using `pszText`. Only applies to the default window.
pParam2 (PMCI_VID_WINDOW_PARMS) - input
A pointer to an MCI_VID_WINDOW_PARMS structure. Device-specific extensions include:
* PMCI_DGV_WINDOW_PARMS — For digital video devices.
* PMCI_OVLY_WINDOW_PARMS — For video overlay devices.

Return Value

rc (ULONG)
* MCIERR_SUCCESS — Success.
* MCIERR_INVALID_DEVICE_ID — Invalid device ID.
* MCIERR_INVALID_FLAG — Invalid flag specified.
* MCIERR_FLAGS_NOT_COMPATIBLE — (e.g., combining `WINDOW_DEFAULT` and `WINDOW_STATE`).
* MCIERR_INSTANCE_INACTIVE — Device instance is inactive.

Remarks

By default, video devices create a window upon opening but keep it hidden until a play command or a show state is received. If an application provides its own window handle via `MCI_DGV_WINDOW_HWND`, it is responsible for handling window painting (updating invalid rectangles).

State and text flags (like `MCI_DGV_WINDOW_STATE`) are provided primarily for the string interface; C/C++ programmers may find it more efficient to use standard Win APIs after retrieving the window handle via MCI_STATUS.

Related Messages

Example Code

The following code illustrates how to redirect video output to an application-supplied window.

    MCI_DGV_WINDOW_PARMS mciWindowParms;
    USHORT usUserParm = 0;
    ULONG  ulReturn;

    /* Initialize structure and set the alternate window handle */
    memset (&mciWindowParms, 0x00, sizeof (MCI_DGV_WINDOW_PARMS));
    mciWindowParms.hwndCallback = hwndNotify;
    mciWindowParms.hwndDest = hwndAlternate; /* The handle to your app window */

    /* Redirect video to the specified HWND */
    ulReturn = mciSendCommand(usDeviceID, MCI_WINDOW,
                      MCI_WAIT | MCI_DGV_WINDOW_HWND,
                      (PVOID)&mciWindowParms,
                      usUserParm);