2001-08-18 20:02:34 +02:00
|
|
|
/*
|
2002-06-01 01:06:46 +02:00
|
|
|
* Copyright 2000 Eric Pouech
|
2003-12-15 21:17:11 +01:00
|
|
|
* Copyright 2003 Dmitry Timoshkov
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2003-12-15 21:17:11 +01:00
|
|
|
*
|
|
|
|
* FIXME:
|
2004-01-01 01:12:13 +01:00
|
|
|
* Add support for all remaining MCI_ commands and MCIWNDM_ messages.
|
|
|
|
* Add support for all MCIWNDF_ flags.
|
2001-08-18 20:02:34 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-08-18 20:02:34 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2001-08-18 20:02:34 +02:00
|
|
|
#include "winnls.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
2003-12-15 21:17:11 +01:00
|
|
|
#include "winreg.h"
|
|
|
|
#include "winternl.h"
|
2001-08-18 20:02:34 +02:00
|
|
|
#include "vfw.h"
|
|
|
|
#include "digitalv.h"
|
|
|
|
#include "commctrl.h"
|
2003-12-15 21:17:11 +01:00
|
|
|
#include "wine/unicode.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mci);
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
extern HMODULE MSVFW32_hModule;
|
|
|
|
static const WCHAR mciWndClassW[] = {'M','C','I','W','n','d','C','l','a','s','s',0};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD dwStyle;
|
|
|
|
MCIDEVICEID mci;
|
2004-01-01 01:12:13 +01:00
|
|
|
HDRVR hdrv;
|
|
|
|
int alias;
|
2003-12-15 21:17:11 +01:00
|
|
|
UINT dev_type;
|
2004-01-01 01:12:13 +01:00
|
|
|
UINT mode;
|
|
|
|
long position;
|
|
|
|
SIZE size; /* size of the original frame rect */
|
|
|
|
int zoom;
|
2003-12-15 21:17:11 +01:00
|
|
|
LPWSTR lpName;
|
|
|
|
HWND hWnd, hwndOwner;
|
|
|
|
UINT uTimer;
|
|
|
|
MCIERROR lasterror;
|
2004-01-01 01:12:13 +01:00
|
|
|
WCHAR return_string[128];
|
|
|
|
WORD active_timer, inactive_timer;
|
2001-08-18 20:02:34 +02:00
|
|
|
} MCIWndInfo;
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
static LRESULT WINAPI MCIWndProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
#define CTL_PLAYSTOP 0x3200
|
|
|
|
#define CTL_MENU 0x3201
|
|
|
|
#define CTL_TRACKBAR 0x3202
|
2001-08-18 20:02:34 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2003-12-15 21:17:11 +01:00
|
|
|
* MCIWndRegisterClass [MSVFW32.@]
|
|
|
|
*
|
|
|
|
* NOTE: Native always uses its own hInstance
|
2001-08-18 20:02:34 +02:00
|
|
|
*/
|
2004-01-01 01:12:13 +01:00
|
|
|
BOOL VFWAPIV MCIWndRegisterClass(void)
|
2001-08-18 20:02:34 +02:00
|
|
|
{
|
2003-12-15 21:17:11 +01:00
|
|
|
WNDCLASSW wc;
|
|
|
|
|
2003-12-31 20:00:03 +01:00
|
|
|
/* Since we are going to register a class belonging to MSVFW32
|
|
|
|
* and later we will create windows with a different hInstance
|
|
|
|
* CS_GLOBALCLASS is needed. And because the second attempt
|
|
|
|
* to register a global class will fail we need to test whether
|
|
|
|
* the class was already registered.
|
|
|
|
*/
|
|
|
|
wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS | CS_OWNDC | CS_GLOBALCLASS;
|
2003-12-15 21:17:11 +01:00
|
|
|
wc.lpfnWndProc = MCIWndProc;
|
|
|
|
wc.cbClsExtra = 0;
|
|
|
|
wc.cbWndExtra = sizeof(MCIWndInfo*);
|
|
|
|
wc.hInstance = MSVFW32_hModule;
|
|
|
|
wc.hIcon = 0;
|
|
|
|
wc.hCursor = LoadCursorW(0, MAKEINTRESOURCEW(IDC_ARROW));
|
|
|
|
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
|
|
wc.lpszMenuName = NULL;
|
|
|
|
wc.lpszClassName = mciWndClassW;
|
|
|
|
|
2003-12-31 20:00:03 +01:00
|
|
|
if (RegisterClassW(&wc)) return TRUE;
|
|
|
|
if (GetLastError() == ERROR_CLASS_ALREADY_EXISTS) return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
2001-08-18 20:02:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2003-12-15 21:17:11 +01:00
|
|
|
* MCIWndCreateW [MSVFW32.@]
|
2001-08-18 20:02:34 +02:00
|
|
|
*/
|
2003-12-15 21:17:11 +01:00
|
|
|
HWND VFWAPIV MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance,
|
|
|
|
DWORD dwStyle, LPCWSTR szFile)
|
2001-08-18 20:02:34 +02:00
|
|
|
{
|
2003-12-15 21:17:11 +01:00
|
|
|
TRACE("%p %p %lx %s\n", hwndParent, hInstance, dwStyle, debugstr_w(szFile));
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWndRegisterClass();
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
if (hwndParent)
|
|
|
|
dwStyle |= WS_VISIBLE | WS_BORDER /*| WS_CHILD*/;
|
|
|
|
else
|
|
|
|
dwStyle |= WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
return CreateWindowExW(0, mciWndClassW, NULL,
|
|
|
|
dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
|
|
|
0, 0, 300, 0,
|
|
|
|
hwndParent, 0, hInstance, (LPVOID)szFile);
|
2001-08-18 20:02:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2003-12-15 21:17:11 +01:00
|
|
|
* MCIWndCreate [MSVFW32.@]
|
|
|
|
* MCIWndCreateA [MSVFW32.@]
|
2001-08-18 20:02:34 +02:00
|
|
|
*/
|
2003-12-15 21:17:11 +01:00
|
|
|
HWND VFWAPIV MCIWndCreateA(HWND hwndParent, HINSTANCE hInstance,
|
|
|
|
DWORD dwStyle, LPCSTR szFile)
|
2001-08-18 20:02:34 +02:00
|
|
|
{
|
2003-12-15 21:17:11 +01:00
|
|
|
HWND ret;
|
|
|
|
UNICODE_STRING fileW;
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
if (szFile)
|
|
|
|
RtlCreateUnicodeStringFromAsciiz(&fileW, szFile);
|
|
|
|
else
|
|
|
|
fileW.Buffer = NULL;
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
ret = MCIWndCreateW(hwndParent, hInstance, dwStyle, fileW.Buffer);
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
RtlFreeUnicodeString(&fileW);
|
|
|
|
return ret;
|
2001-08-18 20:02:34 +02:00
|
|
|
}
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
static inline void MCIWND_notify_mode(MCIWndInfo *mwi)
|
|
|
|
{
|
|
|
|
if (mwi->dwStyle & MCIWNDF_NOTIFYMODE)
|
|
|
|
{
|
|
|
|
UINT new_mode = SendMessageW(mwi->hWnd, MCIWNDM_GETMODEW, 0, 0);
|
|
|
|
if (new_mode != mwi->mode)
|
|
|
|
{
|
|
|
|
mwi->mode = new_mode;
|
|
|
|
SendMessageW(mwi->hwndOwner, MCIWNDM_NOTIFYMODE, (WPARAM)mwi->hWnd, new_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void MCIWND_notify_pos(MCIWndInfo *mwi)
|
|
|
|
{
|
|
|
|
if (mwi->dwStyle & MCIWNDF_NOTIFYPOS)
|
|
|
|
{
|
|
|
|
long new_pos = SendMessageW(mwi->hWnd, MCIWNDM_GETPOSITIONW, 0, 0);
|
|
|
|
if (new_pos != mwi->position)
|
|
|
|
{
|
|
|
|
mwi->position = new_pos;
|
|
|
|
SendMessageW(mwi->hwndOwner, MCIWNDM_NOTIFYPOS, (WPARAM)mwi->hWnd, new_pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void MCIWND_notify_size(MCIWndInfo *mwi)
|
|
|
|
{
|
|
|
|
if (mwi->dwStyle & MCIWNDF_NOTIFYSIZE)
|
|
|
|
SendMessageW(mwi->hwndOwner, MCIWNDM_NOTIFYSIZE, (WPARAM)mwi->hWnd, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void MCIWND_notify_error(MCIWndInfo *mwi)
|
|
|
|
{
|
|
|
|
if (mwi->dwStyle & MCIWNDF_NOTIFYERROR)
|
|
|
|
SendMessageW(mwi->hwndOwner, MCIWNDM_NOTIFYERROR, (WPARAM)mwi->hWnd, (LPARAM)mwi->lasterror);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void MCIWND_UpdateState(MCIWndInfo *mwi)
|
2001-08-18 20:02:34 +02:00
|
|
|
{
|
2003-12-15 21:17:11 +01:00
|
|
|
WCHAR buffer[1024];
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
if (!mwi->mci)
|
|
|
|
{
|
|
|
|
/* FIXME: get this from resources */
|
|
|
|
static const WCHAR no_deviceW[] = {'N','o',' ','D','e','v','i','c','e',0};
|
|
|
|
SetWindowTextW(mwi->hWnd, no_deviceW);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
MCIWND_notify_pos(mwi);
|
|
|
|
|
|
|
|
if (!(mwi->dwStyle & MCIWNDF_NOPLAYBAR))
|
|
|
|
SendDlgItemMessageW(mwi->hWnd, CTL_TRACKBAR, TBM_SETPOS, TRUE, mwi->position);
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
if ((mwi->dwStyle & MCIWNDF_SHOWNAME) && mwi->lpName)
|
|
|
|
strcpyW(buffer, mwi->lpName);
|
|
|
|
else
|
|
|
|
*buffer = 0;
|
|
|
|
|
|
|
|
if (mwi->dwStyle & (MCIWNDF_SHOWPOS|MCIWNDF_SHOWMODE))
|
|
|
|
{
|
|
|
|
static const WCHAR spaceW[] = {' ',0};
|
|
|
|
static const WCHAR l_braceW[] = {'(',0};
|
|
|
|
|
|
|
|
if (*buffer) strcatW(buffer, spaceW);
|
|
|
|
strcatW(buffer, l_braceW);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mwi->dwStyle & MCIWNDF_SHOWPOS)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
WCHAR posW[64];
|
|
|
|
|
|
|
|
posW[0] = 0;
|
|
|
|
SendMessageW(mwi->hWnd, MCIWNDM_GETPOSITIONW, 64, (LPARAM)posW);
|
|
|
|
strcatW(buffer, posW);
|
2003-12-15 21:17:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((mwi->dwStyle & (MCIWNDF_SHOWPOS|MCIWNDF_SHOWMODE)) == (MCIWNDF_SHOWPOS|MCIWNDF_SHOWMODE))
|
|
|
|
{
|
|
|
|
static const WCHAR dashW[] = {' ','-',' ',0};
|
|
|
|
strcatW(buffer, dashW);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mwi->dwStyle & MCIWNDF_SHOWMODE)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
WCHAR modeW[64];
|
|
|
|
|
|
|
|
modeW[0] = 0;
|
|
|
|
SendMessageW(mwi->hWnd, MCIWNDM_GETMODEW, 64, (LPARAM)modeW);
|
|
|
|
strcatW(buffer, modeW);
|
2003-12-15 21:17:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mwi->dwStyle & (MCIWNDF_SHOWPOS|MCIWNDF_SHOWMODE))
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
static const WCHAR r_braceW[] = {')',0};
|
2003-12-15 21:17:11 +01:00
|
|
|
strcatW(buffer, r_braceW);
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("=> '%s'\n", debugstr_w(buffer));
|
|
|
|
SetWindowTextW(mwi->hWnd, buffer);
|
2001-08-18 20:02:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
static LRESULT MCIWND_Create(HWND hWnd, LPCREATESTRUCTW cs)
|
2001-08-18 20:02:34 +02:00
|
|
|
{
|
2003-12-15 21:17:11 +01:00
|
|
|
HWND hChld;
|
|
|
|
MCIWndInfo *mwi;
|
|
|
|
static const WCHAR buttonW[] = {'b','u','t','t','o','n',0};
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
mwi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*mwi));
|
2003-12-15 21:17:11 +01:00
|
|
|
if (!mwi) return -1;
|
|
|
|
|
|
|
|
SetWindowLongW(hWnd, 0, (LPARAM)mwi);
|
|
|
|
|
|
|
|
mwi->dwStyle = cs->style;
|
|
|
|
mwi->hWnd = hWnd;
|
|
|
|
mwi->hwndOwner = cs->hwndParent;
|
2004-01-01 01:12:13 +01:00
|
|
|
mwi->active_timer = 500;
|
|
|
|
mwi->inactive_timer = 2000;
|
|
|
|
mwi->mode = MCI_MODE_NOT_READY;
|
|
|
|
mwi->position = -1;
|
|
|
|
mwi->zoom = 100;
|
2003-12-15 21:17:11 +01:00
|
|
|
|
|
|
|
if (!(mwi->dwStyle & MCIWNDF_NOMENU))
|
|
|
|
{
|
|
|
|
static const WCHAR menuW[] = {'M','e','n','u',0};
|
|
|
|
|
|
|
|
hChld = CreateWindowExW(0, buttonW, menuW, WS_CHILD|WS_VISIBLE, 32, cs->cy, 32, 32,
|
|
|
|
hWnd, (HMENU)CTL_MENU, cs->hInstance, 0L);
|
|
|
|
TRACE("Get Button2: %p\n", hChld);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(mwi->dwStyle & MCIWNDF_NOPLAYBAR))
|
|
|
|
{
|
|
|
|
INITCOMMONCONTROLSEX init;
|
|
|
|
static const WCHAR playW[] = {'P','l','a','y',0};
|
|
|
|
|
|
|
|
/* adding the other elements: play/stop button, menu button, status */
|
|
|
|
hChld = CreateWindowExW(0, buttonW, playW, WS_CHILD|WS_VISIBLE, 0, cs->cy, 32, 32,
|
|
|
|
hWnd, (HMENU)CTL_PLAYSTOP, cs->hInstance, 0L);
|
|
|
|
TRACE("Get Button1: %p\n", hChld);
|
|
|
|
|
|
|
|
init.dwSize = sizeof(init);
|
|
|
|
init.dwICC = ICC_BAR_CLASSES;
|
|
|
|
InitCommonControlsEx(&init);
|
|
|
|
|
|
|
|
hChld = CreateWindowExW(0, TRACKBAR_CLASSW, NULL, WS_CHILD|WS_VISIBLE, 64, cs->cy, cs->cx - 64, 32,
|
|
|
|
hWnd, (HMENU)CTL_TRACKBAR, cs->hInstance, 0L);
|
|
|
|
TRACE("Get status: %p\n", hChld);
|
|
|
|
}
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
/* This sets the default window size */
|
|
|
|
SendMessageW(hWnd, MCI_CLOSE, 0, 0);
|
|
|
|
|
|
|
|
if (cs->lpCreateParams)
|
|
|
|
{
|
|
|
|
LPARAM lParam;
|
|
|
|
|
|
|
|
/* MCI wnd class is prepared to be embedded as an MDI child window */
|
|
|
|
if (cs->dwExStyle & WS_EX_MDICHILD)
|
|
|
|
{
|
|
|
|
MDICREATESTRUCTW *mdics = (MDICREATESTRUCTW *)cs->lpCreateParams;
|
|
|
|
lParam = mdics->lParam;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
lParam = (LPARAM)cs->lpCreateParams;
|
|
|
|
/* yes, A variant of the message */
|
|
|
|
SendMessageW(hWnd, MCIWNDM_OPENA, 0, lParam);
|
|
|
|
}
|
2003-12-15 21:17:11 +01:00
|
|
|
|
|
|
|
return 0;
|
2001-08-18 20:02:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
static void MCIWND_ToggleState(MCIWndInfo *mwi)
|
2001-08-18 20:02:34 +02:00
|
|
|
{
|
2003-12-15 21:17:11 +01:00
|
|
|
switch (SendMessageW(mwi->hWnd, MCIWNDM_GETMODEW, 0, 0))
|
|
|
|
{
|
|
|
|
case MCI_MODE_NOT_READY:
|
|
|
|
case MCI_MODE_RECORD:
|
|
|
|
case MCI_MODE_SEEK:
|
|
|
|
case MCI_MODE_OPEN:
|
|
|
|
TRACE("Cannot do much...\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCI_MODE_PAUSE:
|
|
|
|
SendMessageW(mwi->hWnd, MCI_RESUME, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCI_MODE_PLAY:
|
|
|
|
SendMessageW(mwi->hWnd, MCI_PAUSE, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCI_MODE_STOP:
|
|
|
|
SendMessageW(mwi->hWnd, MCI_STOP, 0, 0);
|
|
|
|
break;
|
|
|
|
}
|
2001-08-18 20:02:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
static LRESULT MCIWND_Command(MCIWndInfo *mwi, WPARAM wParam, LPARAM lParam)
|
2001-08-18 20:02:34 +02:00
|
|
|
{
|
2003-12-15 21:17:11 +01:00
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case CTL_PLAYSTOP: MCIWND_ToggleState(mwi); break;
|
|
|
|
case CTL_MENU:
|
|
|
|
case CTL_TRACKBAR:
|
|
|
|
default:
|
2004-01-01 01:12:13 +01:00
|
|
|
FIXME("support for command %04x not implement yet\n", LOWORD(wParam));
|
2003-12-15 21:17:11 +01:00
|
|
|
}
|
|
|
|
return 0L;
|
2001-08-18 20:02:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
static void MCIWND_notify_media(MCIWndInfo *mwi)
|
2001-08-18 20:02:34 +02:00
|
|
|
{
|
2003-12-15 21:17:11 +01:00
|
|
|
if (mwi->dwStyle & (MCIWNDF_NOTIFYMEDIAA | MCIWNDF_NOTIFYMEDIAW))
|
|
|
|
{
|
|
|
|
if (!mwi->lpName)
|
|
|
|
{
|
|
|
|
static const WCHAR empty_str[1];
|
|
|
|
SendMessageW(mwi->hwndOwner, MCIWNDM_NOTIFYMEDIA, (WPARAM)mwi->hWnd, (LPARAM)empty_str);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (mwi->dwStyle & MCIWNDF_NOTIFYANSI)
|
|
|
|
{
|
|
|
|
char *ansi_name;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
len = WideCharToMultiByte(CP_ACP, 0, mwi->lpName, -1, NULL, 0, NULL, NULL);
|
|
|
|
ansi_name = HeapAlloc(GetProcessHeap(), 0, len);
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, mwi->lpName, -1, ansi_name, len, NULL, NULL);
|
|
|
|
|
|
|
|
SendMessageW(mwi->hwndOwner, MCIWNDM_NOTIFYMEDIA, (WPARAM)mwi->hWnd, (LPARAM)ansi_name);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, ansi_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SendMessageW(mwi->hwndOwner, MCIWNDM_NOTIFYMEDIA, (WPARAM)mwi->hWnd, (LPARAM)mwi->lpName);
|
|
|
|
}
|
|
|
|
}
|
2001-08-18 20:02:34 +02:00
|
|
|
}
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
static MCIERROR mci_generic_command(MCIWndInfo *mwi, UINT cmd)
|
|
|
|
{
|
|
|
|
MCI_GENERIC_PARMS mci_generic;
|
|
|
|
|
|
|
|
mci_generic.dwCallback = 0;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, cmd, 0, (DWORD_PTR)&mci_generic);
|
|
|
|
|
|
|
|
if (mwi->lasterror)
|
|
|
|
return mwi->lasterror;
|
|
|
|
|
|
|
|
MCIWND_notify_mode(mwi);
|
|
|
|
MCIWND_UpdateState(mwi);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT mci_get_devcaps(MCIWndInfo *mwi, UINT cap)
|
|
|
|
{
|
|
|
|
MCI_GETDEVCAPS_PARMS mci_devcaps;
|
|
|
|
|
|
|
|
mci_devcaps.dwItem = cap;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_GETDEVCAPS,
|
|
|
|
MCI_GETDEVCAPS_ITEM,
|
|
|
|
(DWORD_PTR)&mci_devcaps);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return mci_devcaps.dwReturn;
|
|
|
|
}
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
static LRESULT WINAPI MCIWndProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
|
2001-08-18 20:02:34 +02:00
|
|
|
{
|
2003-12-15 21:17:11 +01:00
|
|
|
MCIWndInfo *mwi;
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
TRACE("%p %04x %08x %08lx\n", hWnd, wMsg, wParam, lParam);
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
mwi = (MCIWndInfo*)GetWindowLongW(hWnd, 0);
|
|
|
|
if (!mwi)
|
2004-01-01 01:12:13 +01:00
|
|
|
{
|
|
|
|
if (wMsg == WM_CREATE)
|
|
|
|
return MCIWND_Create(hWnd, (CREATESTRUCTW *)lParam);
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
return DefWindowProcW(hWnd, wMsg, wParam, lParam);
|
2004-01-01 01:12:13 +01:00
|
|
|
}
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
switch (wMsg)
|
|
|
|
{
|
|
|
|
case WM_DESTROY:
|
|
|
|
if (mwi->uTimer)
|
|
|
|
KillTimer(hWnd, mwi->uTimer);
|
2001-08-18 20:02:34 +02:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
if (mwi->mci)
|
|
|
|
SendMessageW(hWnd, MCI_CLOSE, 0, 0);
|
2003-12-15 21:17:11 +01:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, mwi);
|
2004-01-01 01:12:13 +01:00
|
|
|
|
|
|
|
DestroyWindow(GetDlgItem(hWnd, CTL_MENU));
|
|
|
|
DestroyWindow(GetDlgItem(hWnd, CTL_PLAYSTOP));
|
|
|
|
DestroyWindow(GetDlgItem(hWnd, CTL_TRACKBAR));
|
2003-12-15 21:17:11 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_PAINT:
|
|
|
|
{
|
|
|
|
HDC hdc;
|
|
|
|
PAINTSTRUCT ps;
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
hdc = (wParam) ? (HDC)wParam : BeginPaint(hWnd, &ps);
|
2003-12-15 21:17:11 +01:00
|
|
|
/* something to do ? */
|
2004-01-01 01:12:13 +01:00
|
|
|
if (!wParam) EndPaint(hWnd, &ps);
|
2003-12-15 21:17:11 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
return MCIWND_Command(mwi, wParam, lParam);
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
case WM_NCACTIVATE:
|
|
|
|
if (mwi->uTimer)
|
|
|
|
{
|
|
|
|
KillTimer(hWnd, mwi->uTimer);
|
|
|
|
mwi->uTimer = SetTimer(hWnd, 1, wParam ? mwi->active_timer : mwi->inactive_timer, NULL);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
case WM_TIMER:
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_UpdateState(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_SIZE:
|
|
|
|
{
|
|
|
|
SetWindowPos(GetDlgItem(hWnd, CTL_PLAYSTOP), 0, 0, HIWORD(lParam) - 32, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE);
|
|
|
|
SetWindowPos(GetDlgItem(hWnd, CTL_MENU), 0, 32, HIWORD(lParam) - 32, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE);
|
|
|
|
SetWindowPos(GetDlgItem(hWnd, CTL_TRACKBAR), 0, 64, HIWORD(lParam) - 32, LOWORD(lParam) - 64, 32, SWP_NOACTIVATE);
|
2004-01-01 01:12:13 +01:00
|
|
|
|
|
|
|
MCIWND_notify_size(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MM_MCINOTIFY:
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_mode(mwi);
|
|
|
|
MCIWND_UpdateState(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_OPENA:
|
|
|
|
{
|
|
|
|
UNICODE_STRING nameW;
|
2004-01-01 01:12:13 +01:00
|
|
|
TRACE("MCIWNDM_OPENA %s\n", debugstr_a((LPSTR)lParam));
|
2003-12-15 21:17:11 +01:00
|
|
|
RtlCreateUnicodeStringFromAsciiz(&nameW, (LPCSTR)lParam);
|
|
|
|
lParam = (LPARAM)nameW.Buffer;
|
|
|
|
}
|
|
|
|
/* fall through */
|
|
|
|
case MCIWNDM_OPENW:
|
|
|
|
{
|
|
|
|
RECT rc;
|
2004-01-01 01:12:13 +01:00
|
|
|
HCURSOR hCursor;
|
|
|
|
MCI_OPEN_PARMSW mci_open;
|
|
|
|
MCI_GETDEVCAPS_PARMS mci_devcaps;
|
|
|
|
WCHAR aliasW[64];
|
|
|
|
WCHAR drv_name[MAX_PATH];
|
|
|
|
static const WCHAR formatW[] = {'%','d',0};
|
|
|
|
static const WCHAR mci32W[] = {'m','c','i','3','2',0};
|
|
|
|
static const WCHAR system_iniW[] = {'s','y','s','t','e','m','.','i','n','i',0};
|
|
|
|
|
|
|
|
TRACE("MCIWNDM_OPENW %s\n", debugstr_w((LPWSTR)lParam));
|
|
|
|
|
|
|
|
if (wParam == MCIWNDOPENF_NEW)
|
|
|
|
{
|
|
|
|
SendMessageW(hWnd, MCIWNDM_NEWW, 0, lParam);
|
|
|
|
goto end_of_mci_open;
|
|
|
|
}
|
2003-12-15 21:17:11 +01:00
|
|
|
|
|
|
|
if (mwi->uTimer)
|
|
|
|
{
|
|
|
|
KillTimer(hWnd, mwi->uTimer);
|
|
|
|
mwi->uTimer = 0;
|
|
|
|
}
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
hCursor = LoadCursorW(0, (LPWSTR)IDC_WAIT);
|
|
|
|
hCursor = SetCursor(hCursor);
|
|
|
|
|
|
|
|
mci_open.lpstrElementName = (LPWSTR)lParam;
|
|
|
|
wsprintfW(aliasW, formatW, (int)hWnd + 1);
|
|
|
|
mci_open.lpstrAlias = aliasW;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_OPEN,
|
|
|
|
MCI_OPEN_ELEMENT | MCI_OPEN_ALIAS | MCI_WAIT,
|
|
|
|
(DWORD_PTR)&mci_open);
|
|
|
|
SetCursor(hCursor);
|
|
|
|
|
|
|
|
if (mwi->lasterror)
|
2003-12-15 21:17:11 +01:00
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
/* FIXME: get the caption from resources */
|
|
|
|
static const WCHAR caption[] = {'M','C','I',' ','E','r','r','o','r',0};
|
|
|
|
WCHAR error_str[MAXERRORLENGTH];
|
|
|
|
|
|
|
|
mciGetErrorStringW(mwi->lasterror, error_str, MAXERRORLENGTH);
|
|
|
|
MessageBoxW(hWnd, error_str, caption, MB_ICONEXCLAMATION | MB_OK);
|
|
|
|
MCIWND_notify_error(mwi);
|
|
|
|
goto end_of_mci_open;
|
|
|
|
}
|
2003-12-15 21:17:11 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
mwi->mci = mci_open.wDeviceID;
|
|
|
|
mwi->alias = (int)hWnd + 1;
|
2003-12-15 21:17:11 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
mwi->lpName = HeapAlloc(GetProcessHeap(), 0, (strlenW((LPWSTR)lParam) + 1) * sizeof(WCHAR));
|
|
|
|
strcpyW(mwi->lpName, (LPWSTR)lParam);
|
2003-12-15 21:17:11 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_UpdateState(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
mci_devcaps.dwItem = MCI_GETDEVCAPS_DEVICE_TYPE;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_GETDEVCAPS,
|
|
|
|
MCI_GETDEVCAPS_ITEM,
|
|
|
|
(DWORD_PTR)&mci_devcaps);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
|
|
|
MCIWND_notify_error(mwi);
|
|
|
|
goto end_of_mci_open;
|
|
|
|
}
|
2003-12-15 21:17:11 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
mwi->dev_type = mci_devcaps.dwReturn;
|
2003-12-15 21:17:11 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
drv_name[0] = 0;
|
|
|
|
SendMessageW(hWnd, MCIWNDM_GETDEVICEW, 256, (LPARAM)drv_name);
|
|
|
|
if (drv_name[0] && GetPrivateProfileStringW(mci32W, drv_name, NULL,
|
|
|
|
drv_name, MAX_PATH, system_iniW))
|
|
|
|
mwi->hdrv = OpenDriver(drv_name, NULL, 0);
|
2003-12-15 21:17:11 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
if (mwi->dev_type == MCI_DEVTYPE_DIGITAL_VIDEO)
|
|
|
|
{
|
|
|
|
MCI_DGV_WINDOW_PARMSW mci_window;
|
|
|
|
|
|
|
|
mci_window.hWnd = hWnd;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_WINDOW,
|
|
|
|
MCI_DGV_WINDOW_HWND,
|
|
|
|
(DWORD_PTR)&mci_window);
|
2003-12-15 21:17:11 +01:00
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_error(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
goto end_of_mci_open;
|
|
|
|
}
|
2004-01-01 01:12:13 +01:00
|
|
|
}
|
2003-12-15 21:17:11 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
if (SendMessageW(hWnd, MCIWNDM_GET_DEST, 0, (LPARAM)&rc) == 0)
|
|
|
|
{
|
|
|
|
mwi->size.cx = rc.right - rc.left;
|
|
|
|
mwi->size.cy = rc.bottom - rc.top;
|
2003-12-15 21:17:11 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
rc.right = MulDiv(mwi->size.cx, mwi->zoom, 100);
|
|
|
|
rc.bottom = MulDiv(mwi->size.cy, mwi->zoom, 100);
|
|
|
|
SendMessageW(hWnd, MCIWNDM_PUT_DEST, 0, (LPARAM)&rc);
|
2003-12-15 21:17:11 +01:00
|
|
|
}
|
2004-01-01 01:12:13 +01:00
|
|
|
else
|
2003-12-15 21:17:11 +01:00
|
|
|
{
|
|
|
|
GetClientRect(hWnd, &rc);
|
|
|
|
rc.bottom = rc.top;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(mwi->dwStyle & MCIWNDF_NOPLAYBAR))
|
|
|
|
rc.bottom += 32; /* add the height of the playbar */
|
2004-01-01 01:12:13 +01:00
|
|
|
AdjustWindowRect(&rc, GetWindowLongW(hWnd, GWL_STYLE), FALSE);
|
2003-12-15 21:17:11 +01:00
|
|
|
SetWindowPos(hWnd, 0, 0, 0, rc.right - rc.left,
|
2004-01-01 01:12:13 +01:00
|
|
|
rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
2003-12-15 21:17:11 +01:00
|
|
|
|
|
|
|
SendDlgItemMessageW(hWnd, CTL_TRACKBAR, TBM_SETRANGEMIN, 0L, 0L);
|
2004-01-01 01:12:13 +01:00
|
|
|
SendDlgItemMessageW(hWnd, CTL_TRACKBAR, TBM_SETRANGEMAX, 1,
|
|
|
|
SendMessageW(hWnd, MCIWNDM_GETLENGTH, 0, 0));
|
|
|
|
mwi->uTimer = SetTimer(hWnd, 1, mwi->active_timer, NULL);
|
|
|
|
|
|
|
|
MCIWND_notify_media(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
|
|
|
|
end_of_mci_open:
|
|
|
|
if (wMsg == MCIWNDM_OPENA)
|
|
|
|
HeapFree(GetProcessHeap(), 0, (void *)lParam);
|
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_GETDEVICEID:
|
|
|
|
return mwi->mci;
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
case MCIWNDM_GETALIAS:
|
|
|
|
return mwi->alias;
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
case MCIWNDM_GET_SOURCE:
|
|
|
|
{
|
|
|
|
MCI_DGV_RECT_PARMS mci_rect;
|
|
|
|
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_WHERE,
|
|
|
|
MCI_DGV_WHERE_SOURCE,
|
|
|
|
(DWORD_PTR)&mci_rect);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_error(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
*(RECT *)lParam = mci_rect.rc;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_GET_DEST:
|
|
|
|
{
|
|
|
|
MCI_DGV_RECT_PARMS mci_rect;
|
|
|
|
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_WHERE,
|
|
|
|
MCI_DGV_WHERE_DESTINATION,
|
|
|
|
(DWORD_PTR)&mci_rect);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_error(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
*(RECT *)lParam = mci_rect.rc;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_PUT_SOURCE:
|
|
|
|
{
|
|
|
|
MCI_DGV_PUT_PARMS mci_put;
|
|
|
|
|
|
|
|
mci_put.rc = *(RECT *)lParam;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_PUT,
|
|
|
|
MCI_DGV_PUT_SOURCE,
|
|
|
|
(DWORD_PTR)&mci_put);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_error(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_PUT_DEST:
|
|
|
|
{
|
|
|
|
MCI_DGV_PUT_PARMS mci_put;
|
|
|
|
|
|
|
|
mci_put.rc = *(RECT *)lParam;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_PUT,
|
2004-01-01 01:12:13 +01:00
|
|
|
MCI_DGV_PUT_DESTINATION | MCI_DGV_RECT,
|
2003-12-15 21:17:11 +01:00
|
|
|
(DWORD_PTR)&mci_put);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_error(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_GETLENGTH:
|
|
|
|
{
|
|
|
|
MCI_STATUS_PARMS mci_status;
|
|
|
|
|
|
|
|
mci_status.dwItem = MCI_STATUS_LENGTH;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_STATUS,
|
|
|
|
MCI_STATUS_ITEM,
|
|
|
|
(DWORD_PTR)&mci_status);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_error(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return mci_status.dwReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_GETSTART:
|
|
|
|
{
|
|
|
|
MCI_STATUS_PARMS mci_status;
|
|
|
|
|
|
|
|
mci_status.dwItem = MCI_STATUS_POSITION;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_STATUS,
|
|
|
|
MCI_STATUS_ITEM | MCI_STATUS_START,
|
|
|
|
(DWORD_PTR)&mci_status);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_error(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return mci_status.dwReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_GETEND:
|
|
|
|
{
|
|
|
|
LRESULT start, length;
|
|
|
|
|
|
|
|
start = SendMessageW(hWnd, MCIWNDM_GETSTART, 0, 0);
|
|
|
|
length = SendMessageW(hWnd, MCIWNDM_GETLENGTH, 0, 0);
|
|
|
|
return (start + length);
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_GETPOSITIONA:
|
|
|
|
case MCIWNDM_GETPOSITIONW:
|
|
|
|
{
|
|
|
|
MCI_STATUS_PARMS mci_status;
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
/* get position string if requested */
|
|
|
|
if (wParam && lParam)
|
|
|
|
{
|
|
|
|
if (wMsg == MCIWNDM_GETPOSITIONA)
|
|
|
|
{
|
|
|
|
char cmd[64];
|
|
|
|
|
|
|
|
wsprintfA(cmd, "status %d position", mwi->alias);
|
|
|
|
mwi->lasterror = mciSendStringA(cmd, (LPSTR)lParam, wParam, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
WCHAR cmdW[64];
|
|
|
|
static const WCHAR formatW[] = {'s','t','a','t','u','s',' ','%','d',' ','p','o','s','i','t','i','o','n',0};
|
|
|
|
|
|
|
|
wsprintfW(cmdW, formatW, mwi->alias);
|
|
|
|
mwi->lasterror = mciSendStringW(cmdW, (LPWSTR)lParam, wParam, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mwi->lasterror)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
mci_status.dwItem = MCI_STATUS_POSITION;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_STATUS,
|
|
|
|
MCI_STATUS_ITEM,
|
|
|
|
(DWORD_PTR)&mci_status);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
return 0;
|
2004-01-01 01:12:13 +01:00
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
return mci_status.dwReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_GETMODEA:
|
|
|
|
case MCIWNDM_GETMODEW:
|
|
|
|
{
|
|
|
|
MCI_STATUS_PARMS mci_status;
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
if (!mwi->mci)
|
|
|
|
return MCI_MODE_NOT_READY;
|
|
|
|
|
|
|
|
/* get mode string if requested */
|
|
|
|
if (wParam && lParam)
|
|
|
|
{
|
|
|
|
if (wMsg == MCIWNDM_GETMODEA)
|
|
|
|
{
|
|
|
|
char cmd[64];
|
|
|
|
|
|
|
|
wsprintfA(cmd, "status %d mode", mwi->alias);
|
|
|
|
mwi->lasterror = mciSendStringA(cmd, (LPSTR)lParam, wParam, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
WCHAR cmdW[64];
|
|
|
|
static const WCHAR formatW[] = {'s','t','a','t','u','s',' ','%','d',' ','m','o','d','e',0};
|
|
|
|
|
|
|
|
wsprintfW(cmdW, formatW, mwi->alias);
|
|
|
|
mwi->lasterror = mciSendStringW(cmdW, (LPWSTR)lParam, wParam, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mwi->lasterror)
|
|
|
|
return MCI_MODE_NOT_READY;
|
|
|
|
}
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
mci_status.dwItem = MCI_STATUS_MODE;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_STATUS,
|
|
|
|
MCI_STATUS_ITEM,
|
|
|
|
(DWORD_PTR)&mci_status);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
return MCI_MODE_NOT_READY;
|
|
|
|
|
|
|
|
return mci_status.dwReturn;
|
|
|
|
}
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
case MCIWNDM_PLAYFROM:
|
|
|
|
{
|
|
|
|
MCI_PLAY_PARMS mci_play;
|
|
|
|
|
|
|
|
mci_play.dwCallback = (DWORD_PTR)hWnd;
|
|
|
|
mci_play.dwFrom = lParam;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_PLAY,
|
|
|
|
MCI_FROM | MCI_NOTIFY,
|
|
|
|
(DWORD_PTR)&mci_play);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
|
|
|
MCIWND_notify_error(mwi);
|
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
|
|
|
|
MCIWND_notify_mode(mwi);
|
|
|
|
MCIWND_UpdateState(mwi);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
case MCIWNDM_PLAYTO:
|
|
|
|
{
|
|
|
|
MCI_PLAY_PARMS mci_play;
|
|
|
|
|
|
|
|
mci_play.dwCallback = (DWORD_PTR)hWnd;
|
|
|
|
mci_play.dwTo = lParam;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_PLAY,
|
2004-01-01 01:12:13 +01:00
|
|
|
MCI_TO | MCI_NOTIFY,
|
|
|
|
(DWORD_PTR)&mci_play);
|
2003-12-15 21:17:11 +01:00
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_error(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
2004-01-01 01:12:13 +01:00
|
|
|
|
|
|
|
MCIWND_notify_mode(mwi);
|
|
|
|
MCIWND_UpdateState(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
|
|
|
|
case MCIWNDM_PLAYREVERSE:
|
|
|
|
{
|
|
|
|
MCI_PLAY_PARMS mci_play;
|
|
|
|
DWORD flags = MCI_NOTIFY;
|
|
|
|
|
|
|
|
mci_play.dwCallback = (DWORD_PTR)hWnd;
|
|
|
|
mci_play.dwFrom = lParam;
|
|
|
|
switch (mwi->dev_type)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case MCI_DEVTYPE_ANIMATION:
|
|
|
|
flags |= MCI_ANIM_PLAY_REVERSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCI_DEVTYPE_DIGITAL_VIDEO:
|
|
|
|
flags |= MCI_DGV_PLAY_REVERSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef MCI_VCR_PLAY_REVERSE
|
|
|
|
case MCI_DEVTYPE_VCR:
|
|
|
|
flags |= MCI_VCR_PLAY_REVERSE;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case MCI_DEVTYPE_VIDEODISC:
|
|
|
|
flags |= MCI_VD_PLAY_REVERSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_PLAY,
|
|
|
|
flags, (DWORD_PTR)&mci_play);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
|
|
|
MCIWND_notify_error(mwi);
|
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
|
|
|
|
MCIWND_notify_mode(mwi);
|
|
|
|
MCIWND_UpdateState(mwi);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_GETERRORA:
|
2003-12-15 21:17:11 +01:00
|
|
|
mciGetErrorStringA(mwi->lasterror, (LPSTR)lParam, wParam);
|
|
|
|
return mwi->lasterror;
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
case MCIWNDM_GETERRORW:
|
2003-12-15 21:17:11 +01:00
|
|
|
mciGetErrorStringW(mwi->lasterror, (LPWSTR)lParam, wParam);
|
|
|
|
return mwi->lasterror;
|
|
|
|
|
|
|
|
case MCIWNDM_SETOWNER:
|
|
|
|
mwi->hwndOwner = (HWND)wParam;
|
|
|
|
return 0;
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
case MCIWNDM_SENDSTRINGA:
|
2003-12-31 20:00:03 +01:00
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
UNICODE_STRING stringW;
|
|
|
|
RtlCreateUnicodeStringFromAsciiz(&stringW, (LPCSTR)lParam);
|
|
|
|
lParam = (LPARAM)stringW.Buffer;
|
2003-12-31 20:00:03 +01:00
|
|
|
}
|
2004-01-01 01:12:13 +01:00
|
|
|
/* fall through */
|
|
|
|
case MCIWNDM_SENDSTRINGW:
|
|
|
|
{
|
|
|
|
WCHAR *cmdW, *p;
|
2003-12-31 20:00:03 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
p = strchrW((LPCWSTR)lParam, ' ');
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
static const WCHAR formatW[] = {'%','d',' ',0};
|
|
|
|
int len, pos;
|
|
|
|
|
|
|
|
pos = p - (WCHAR *)lParam + 1;
|
|
|
|
len = lstrlenW((LPCWSTR)lParam) + 64;
|
|
|
|
|
|
|
|
cmdW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
|
|
|
|
|
|
|
memcpy(cmdW, (void *)lParam, pos * sizeof(WCHAR));
|
|
|
|
wsprintfW(cmdW + pos, formatW, mwi->alias);
|
|
|
|
strcatW(cmdW, (WCHAR *)lParam + pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cmdW = (LPWSTR)lParam;
|
|
|
|
|
|
|
|
mwi->lasterror = mciSendStringW(cmdW, mwi->return_string,
|
|
|
|
sizeof(mwi->return_string)/sizeof(mwi->return_string[0]),
|
|
|
|
0);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
MCIWND_notify_error(mwi);
|
|
|
|
|
|
|
|
if (cmdW != (LPWSTR)lParam)
|
|
|
|
HeapFree(GetProcessHeap(), 0, cmdW);
|
|
|
|
|
|
|
|
if (wMsg == MCIWNDM_SENDSTRINGA)
|
|
|
|
HeapFree(GetProcessHeap(), 0, (void *)lParam);
|
|
|
|
|
|
|
|
MCIWND_UpdateState(mwi);
|
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_RETURNSTRINGA:
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, mwi->return_string, -1, (LPSTR)lParam, wParam, NULL, NULL);
|
|
|
|
return mwi->lasterror;
|
|
|
|
|
|
|
|
case MCIWNDM_RETURNSTRINGW:
|
|
|
|
strncpyW((LPWSTR)lParam, mwi->return_string, wParam);
|
|
|
|
return mwi->lasterror;
|
|
|
|
|
|
|
|
case MCIWNDM_SETTIMERS:
|
|
|
|
mwi->active_timer = (WORD)wParam;
|
|
|
|
mwi->inactive_timer = (WORD)lParam;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_SETACTIVETIMER:
|
|
|
|
mwi->active_timer = (WORD)wParam;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_SETINACTIVETIMER:
|
|
|
|
mwi->inactive_timer = (WORD)wParam;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_GETACTIVETIMER:
|
|
|
|
return mwi->active_timer;
|
|
|
|
|
|
|
|
case MCIWNDM_GETINACTIVETIMER:
|
|
|
|
return mwi->inactive_timer;
|
|
|
|
|
|
|
|
case MCIWNDM_CHANGESTYLES:
|
|
|
|
/* FIXME: update the visual window state as well:
|
|
|
|
* add/remove trackbar, autosize, etc.
|
|
|
|
*/
|
|
|
|
mwi->dwStyle &= ~wParam;
|
|
|
|
mwi->dwStyle |= lParam & wParam;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_GETSTYLES:
|
|
|
|
return mwi->dwStyle & 0xffff;
|
|
|
|
|
|
|
|
case MCIWNDM_GETDEVICEA:
|
2003-12-31 20:00:03 +01:00
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCI_SYSINFO_PARMSA mci_sysinfo;
|
2003-12-31 20:00:03 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
mci_sysinfo.lpstrReturn = (LPSTR)lParam;
|
|
|
|
mci_sysinfo.dwRetSize = wParam;
|
|
|
|
mwi->lasterror = mciSendCommandA(mwi->mci, MCI_SYSINFO,
|
|
|
|
MCI_SYSINFO_INSTALLNAME,
|
|
|
|
(DWORD_PTR)&mci_sysinfo);
|
|
|
|
return 0;
|
|
|
|
}
|
2003-12-31 20:00:03 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
case MCIWNDM_GETDEVICEW:
|
|
|
|
{
|
|
|
|
MCI_SYSINFO_PARMSW mci_sysinfo;
|
|
|
|
|
|
|
|
mci_sysinfo.lpstrReturn = (LPWSTR)lParam;
|
|
|
|
mci_sysinfo.dwRetSize = wParam;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_SYSINFO,
|
|
|
|
MCI_SYSINFO_INSTALLNAME,
|
|
|
|
(DWORD_PTR)&mci_sysinfo);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_VALIDATEMEDIA:
|
|
|
|
if (mwi->mci)
|
|
|
|
{
|
|
|
|
SendMessageW(hWnd, MCIWNDM_GETSTART, 0, 0);
|
|
|
|
SendMessageW(hWnd, MCIWNDM_GETLENGTH, 0, 0);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_GETFILENAMEA:
|
|
|
|
if (mwi->lpName)
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, mwi->lpName, -1, (LPSTR)lParam, wParam, NULL, NULL);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_GETFILENAMEW:
|
|
|
|
if (mwi->lpName)
|
|
|
|
strncpyW((LPWSTR)lParam, mwi->lpName, wParam);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_GETTIMEFORMATA:
|
|
|
|
case MCIWNDM_GETTIMEFORMATW:
|
|
|
|
{
|
|
|
|
MCI_STATUS_PARMS mci_status;
|
|
|
|
|
|
|
|
/* get format string if requested */
|
|
|
|
if (wParam && lParam)
|
|
|
|
{
|
|
|
|
if (wMsg == MCIWNDM_GETTIMEFORMATA)
|
|
|
|
{
|
|
|
|
char cmd[64];
|
|
|
|
|
|
|
|
wsprintfA(cmd, "status %d time format", mwi->alias);
|
|
|
|
mwi->lasterror = mciSendStringA(cmd, (LPSTR)lParam, wParam, 0);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WCHAR cmdW[64];
|
|
|
|
static const WCHAR formatW[] = {'s','t','a','t','u','s',' ','%','d',' ','t','i','m','e',' ','f','o','r','m','a','t',0};
|
|
|
|
|
|
|
|
wsprintfW(cmdW, formatW, mwi->alias);
|
|
|
|
mwi->lasterror = mciSendStringW(cmdW, (LPWSTR)lParam, wParam, 0);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mci_status.dwItem = MCI_STATUS_TIME_FORMAT ;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_STATUS,
|
|
|
|
MCI_STATUS_ITEM,
|
|
|
|
(DWORD_PTR)&mci_status);
|
2003-12-31 20:00:03 +01:00
|
|
|
if (mwi->lasterror)
|
2004-01-01 01:12:13 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
return mci_status.dwReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_SETTIMEFORMATA:
|
|
|
|
{
|
|
|
|
UNICODE_STRING stringW;
|
|
|
|
|
|
|
|
RtlCreateUnicodeStringFromAsciiz(&stringW, (LPCSTR)lParam);
|
|
|
|
lParam = (LPARAM)stringW.Buffer;
|
|
|
|
}
|
|
|
|
/* fall through */
|
|
|
|
case MCIWNDM_SETTIMEFORMATW:
|
|
|
|
{
|
|
|
|
static const WCHAR formatW[] = {'s','e','t',' ','%','d',' ','t','i','m','e',' ','f','o','r','m','a','t',' ',0};
|
|
|
|
WCHAR *cmdW;
|
|
|
|
|
|
|
|
if (mwi->mci)
|
2003-12-31 20:00:03 +01:00
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
cmdW = HeapAlloc(GetProcessHeap(), 0, (lstrlenW((LPCWSTR)lParam) + 64) * sizeof(WCHAR));
|
|
|
|
wsprintfW(cmdW, formatW, mwi->alias);
|
|
|
|
strcatW(cmdW, (WCHAR *)lParam);
|
|
|
|
|
|
|
|
mwi->lasterror = mciSendStringW(cmdW, NULL, 0, 0);
|
2004-01-02 02:48:15 +01:00
|
|
|
|
|
|
|
/* fix the range tracking according to the new time format */
|
|
|
|
if (!mwi->lasterror)
|
|
|
|
SendDlgItemMessageW(hWnd, CTL_TRACKBAR, TBM_SETRANGEMAX, 1,
|
|
|
|
SendMessageW(hWnd, MCIWNDM_GETLENGTH, 0, 0));
|
2003-12-31 20:00:03 +01:00
|
|
|
}
|
2004-01-01 01:12:13 +01:00
|
|
|
|
|
|
|
if (wMsg == MCIWNDM_SETTIMEFORMATA)
|
|
|
|
HeapFree(GetProcessHeap(), 0, (void *)lParam);
|
|
|
|
|
2003-12-31 20:00:03 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
case MCIWNDM_CAN_PLAY:
|
|
|
|
if (mwi->mci)
|
|
|
|
return mci_get_devcaps(mwi, MCI_GETDEVCAPS_CAN_PLAY);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_CAN_RECORD:
|
|
|
|
if (mwi->mci)
|
|
|
|
return mci_get_devcaps(mwi, MCI_GETDEVCAPS_CAN_RECORD);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_CAN_SAVE:
|
|
|
|
if (mwi->mci)
|
|
|
|
return mci_get_devcaps(mwi, MCI_GETDEVCAPS_CAN_SAVE);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_CAN_EJECT:
|
|
|
|
if (mwi->mci)
|
|
|
|
return mci_get_devcaps(mwi, MCI_GETDEVCAPS_CAN_EJECT);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_CAN_WINDOW:
|
|
|
|
switch (mwi->dev_type)
|
|
|
|
{
|
|
|
|
case MCI_DEVTYPE_ANIMATION:
|
|
|
|
case MCI_DEVTYPE_DIGITAL_VIDEO:
|
|
|
|
case MCI_DEVTYPE_OVERLAY:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_CAN_CONFIG:
|
|
|
|
if (mwi->hdrv)
|
|
|
|
return SendDriverMessage(mwi->hdrv, DRV_QUERYCONFIGURE, 0, 0);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_SETZOOM:
|
|
|
|
mwi->zoom = lParam;
|
|
|
|
|
|
|
|
if (mwi->mci)
|
|
|
|
{
|
|
|
|
RECT rc;
|
|
|
|
|
|
|
|
SetRectEmpty(&rc);
|
|
|
|
rc.right = MulDiv(mwi->size.cx, mwi->zoom, 100);
|
|
|
|
rc.bottom = MulDiv(mwi->size.cy, mwi->zoom, 100);
|
|
|
|
SendMessageW(hWnd, MCIWNDM_PUT_DEST, 0, (LPARAM)&rc);
|
|
|
|
|
|
|
|
if (!(mwi->dwStyle & MCIWNDF_NOPLAYBAR))
|
|
|
|
rc.bottom += 32; /* add the height of the playbar */
|
|
|
|
AdjustWindowRect(&rc, GetWindowLongW(hWnd, GWL_STYLE), FALSE);
|
|
|
|
SetWindowPos(hWnd, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
|
|
|
|
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCIWNDM_GETZOOM:
|
|
|
|
return mwi->zoom;
|
|
|
|
|
|
|
|
case MCIWNDM_EJECT:
|
|
|
|
{
|
|
|
|
MCI_SET_PARMS mci_set;
|
|
|
|
|
2004-01-02 02:48:15 +01:00
|
|
|
mci_set.dwCallback = (DWORD_PTR)hWnd;
|
2004-01-01 01:12:13 +01:00
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_SET,
|
|
|
|
MCI_SET_DOOR_OPEN | MCI_NOTIFY,
|
|
|
|
(DWORD_PTR)&mci_set);
|
2004-01-02 02:48:15 +01:00
|
|
|
MCIWND_notify_mode(mwi);
|
|
|
|
MCIWND_UpdateState(mwi);
|
2004-01-01 01:12:13 +01:00
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCIWNDM_SETVOLUME:
|
|
|
|
case MCIWNDM_GETVOLUME:
|
|
|
|
case MCIWNDM_SETSPEED:
|
|
|
|
case MCIWNDM_GETSPEED:
|
|
|
|
case MCIWNDM_SETREPEAT:
|
|
|
|
case MCIWNDM_GETREPEAT:
|
|
|
|
case MCIWNDM_REALIZE:
|
|
|
|
case MCIWNDM_GETPALETTE:
|
|
|
|
case MCIWNDM_SETPALETTE:
|
|
|
|
case MCIWNDM_NEWA:
|
|
|
|
case MCIWNDM_NEWW:
|
|
|
|
case MCIWNDM_PALETTEKICK:
|
|
|
|
case MCIWNDM_OPENINTERFACE:
|
|
|
|
FIXME("support for MCIWNDM_ message WM_USER+%d not implemented\n", wMsg - WM_USER);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCI_PLAY:
|
|
|
|
{
|
|
|
|
LRESULT end = SendMessageW(hWnd, MCIWNDM_GETEND, 0, 0);
|
|
|
|
return SendMessageW(hWnd, MCIWNDM_PLAYTO, 0, end);
|
|
|
|
}
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
case MCI_SEEK:
|
|
|
|
{
|
|
|
|
MCI_SEEK_PARMS mci_seek;
|
|
|
|
|
|
|
|
switch (lParam)
|
|
|
|
{
|
|
|
|
case MCIWND_START:
|
|
|
|
lParam = SendMessageW(hWnd, MCIWNDM_GETSTART, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCIWND_END:
|
|
|
|
lParam = SendMessageW(hWnd, MCIWNDM_GETEND, 0, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
mci_seek.dwTo = lParam;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_SEEK,
|
|
|
|
MCI_TO, (DWORD_PTR)&mci_seek);
|
|
|
|
if (mwi->lasterror)
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_notify_error(mwi);
|
2003-12-15 21:17:11 +01:00
|
|
|
return mwi->lasterror;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCI_CLOSE:
|
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
RECT rc;
|
2003-12-15 21:17:11 +01:00
|
|
|
MCI_GENERIC_PARMS mci_generic;
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
if (mwi->hdrv)
|
|
|
|
{
|
|
|
|
CloseDriver(mwi->hdrv, 0, 0);
|
|
|
|
mwi->hdrv = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mwi->mci)
|
|
|
|
{
|
|
|
|
mci_generic.dwCallback = 0;
|
|
|
|
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_CLOSE,
|
|
|
|
0, (DWORD_PTR)&mci_generic);
|
|
|
|
mwi->mci = 0;
|
|
|
|
}
|
2003-12-31 20:00:03 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
mwi->mode = MCI_MODE_NOT_READY;
|
|
|
|
mwi->position = -1;
|
|
|
|
|
|
|
|
if (mwi->lpName)
|
2003-12-31 20:00:03 +01:00
|
|
|
{
|
2004-01-01 01:12:13 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, mwi->lpName);
|
|
|
|
mwi->lpName = NULL;
|
2003-12-31 20:00:03 +01:00
|
|
|
}
|
2004-01-01 01:12:13 +01:00
|
|
|
MCIWND_UpdateState(mwi);
|
|
|
|
|
|
|
|
GetClientRect(hWnd, &rc);
|
|
|
|
rc.bottom = rc.top;
|
|
|
|
if (!(mwi->dwStyle & MCIWNDF_NOPLAYBAR))
|
|
|
|
rc.bottom += 32; /* add the height of the playbar */
|
|
|
|
AdjustWindowRect(&rc, GetWindowLongW(hWnd, GWL_STYLE), FALSE);
|
|
|
|
SetWindowPos(hWnd, 0, 0, 0, rc.right - rc.left,
|
|
|
|
rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
|
|
|
MCIWND_notify_media(mwi);
|
2003-12-31 20:00:03 +01:00
|
|
|
return 0;
|
2003-12-15 21:17:11 +01:00
|
|
|
}
|
2004-01-01 01:12:13 +01:00
|
|
|
|
|
|
|
case MCI_PAUSE:
|
|
|
|
case MCI_STEP:
|
|
|
|
case MCI_STOP:
|
|
|
|
case MCI_RESUME:
|
|
|
|
return mci_generic_command(mwi, wMsg);
|
|
|
|
|
|
|
|
case MCI_CONFIGURE:
|
|
|
|
if (mwi->hdrv)
|
|
|
|
SendDriverMessage(mwi->hdrv, DRV_CONFIGURE, (LPARAM)hWnd, 0);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MCI_BREAK:
|
|
|
|
case MCI_CAPTURE:
|
|
|
|
case MCI_COPY:
|
|
|
|
case MCI_CUE:
|
|
|
|
case MCI_CUT:
|
|
|
|
case MCI_DELETE:
|
|
|
|
case MCI_ESCAPE:
|
|
|
|
case MCI_FREEZE:
|
|
|
|
case MCI_GETDEVCAPS:
|
|
|
|
/*case MCI_INDEX:*/
|
|
|
|
case MCI_INFO:
|
|
|
|
case MCI_LIST:
|
|
|
|
case MCI_LOAD:
|
|
|
|
/*case MCI_MARK:*/
|
|
|
|
case MCI_MONITOR:
|
|
|
|
case MCI_OPEN:
|
|
|
|
case MCI_PASTE:
|
|
|
|
case MCI_PUT:
|
|
|
|
case MCI_QUALITY:
|
|
|
|
case MCI_REALIZE:
|
|
|
|
case MCI_RECORD:
|
|
|
|
case MCI_RESERVE:
|
|
|
|
case MCI_RESTORE:
|
|
|
|
case MCI_SAVE:
|
|
|
|
case MCI_SET:
|
|
|
|
case MCI_SETAUDIO:
|
|
|
|
/*case MCI_SETTIMECODE:*/
|
|
|
|
/*case MCI_SETTUNER:*/
|
|
|
|
case MCI_SETVIDEO:
|
|
|
|
case MCI_SIGNAL:
|
|
|
|
case MCI_SPIN:
|
|
|
|
case MCI_STATUS:
|
|
|
|
case MCI_SYSINFO:
|
|
|
|
case MCI_UNDO:
|
|
|
|
case MCI_UNFREEZE:
|
|
|
|
case MCI_UPDATE:
|
|
|
|
case MCI_WHERE:
|
|
|
|
case MCI_WINDOW:
|
|
|
|
FIXME("support for MCI_ command %04x not implemented\n", wMsg);
|
|
|
|
return 0;
|
2003-12-15 21:17:11 +01:00
|
|
|
}
|
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
if (wMsg >= WM_USER)
|
2003-12-15 21:17:11 +01:00
|
|
|
{
|
2003-12-10 03:10:18 +01:00
|
|
|
FIXME("support for MCIWNDM_ message WM_USER+%d not implemented\n", wMsg - WM_USER);
|
|
|
|
return 0;
|
2003-12-15 21:17:11 +01:00
|
|
|
}
|
2003-12-10 03:10:18 +01:00
|
|
|
|
2004-01-01 01:12:13 +01:00
|
|
|
if (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
|
|
|
|
return DefMDIChildProcW(hWnd, wMsg, wParam, lParam);
|
|
|
|
|
2003-12-15 21:17:11 +01:00
|
|
|
return DefWindowProcW(hWnd, wMsg, wParam, lParam);
|
2001-08-18 20:02:34 +02:00
|
|
|
}
|