2 * Copyright 2000 Eric Pouech
3 * Copyright 2003 Dmitry Timoshkov
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * Add support for all remaining MCI_ commands and MCIWNDM_ messages.
21 * Add support for MCIWNDF_RECORD.
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mci
);
39 extern HMODULE MSVFW32_hModule
;
40 static const WCHAR mciWndClassW
[] = {'M','C','I','W','n','d','C','l','a','s','s',0};
51 SIZE size
; /* size of the original frame rect */
57 WCHAR return_string
[128];
58 WORD active_timer
, inactive_timer
;
61 static LRESULT WINAPI
MCIWndProc(HWND hWnd
, UINT wMsg
, WPARAM wParam
, LPARAM lParam
);
63 #define CTL_PLAYSTOP 0x3200
64 #define CTL_MENU 0x3201
65 #define CTL_TRACKBAR 0x3202
67 /***********************************************************************
68 * MCIWndRegisterClass [MSVFW32.@]
70 * NOTE: Native always uses its own hInstance
72 BOOL VFWAPIV
MCIWndRegisterClass(void)
76 /* Since we are going to register a class belonging to MSVFW32
77 * and later we will create windows with a different hInstance
78 * CS_GLOBALCLASS is needed. And because the second attempt
79 * to register a global class will fail we need to test whether
80 * the class was already registered.
82 wc
.style
= CS_VREDRAW
| CS_HREDRAW
| CS_DBLCLKS
| CS_OWNDC
| CS_GLOBALCLASS
;
83 wc
.lpfnWndProc
= MCIWndProc
;
85 wc
.cbWndExtra
= sizeof(MCIWndInfo
*);
86 wc
.hInstance
= MSVFW32_hModule
;
88 wc
.hCursor
= LoadCursorW(0, (LPWSTR
)IDC_ARROW
);
89 wc
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+ 1);
90 wc
.lpszMenuName
= NULL
;
91 wc
.lpszClassName
= mciWndClassW
;
93 if (RegisterClassW(&wc
)) return TRUE
;
94 if (GetLastError() == ERROR_CLASS_ALREADY_EXISTS
) return TRUE
;
99 /***********************************************************************
100 * MCIWndCreateW [MSVFW32.@]
102 HWND VFWAPIV
MCIWndCreateW(HWND hwndParent
, HINSTANCE hInstance
,
103 DWORD dwStyle
, LPCWSTR szFile
)
105 TRACE("%p %p %x %s\n", hwndParent
, hInstance
, dwStyle
, debugstr_w(szFile
));
107 MCIWndRegisterClass();
109 if (!hInstance
) hInstance
= GetModuleHandleW(0);
112 dwStyle
|= WS_VISIBLE
| WS_BORDER
/*| WS_CHILD*/;
114 dwStyle
|= WS_VISIBLE
| WS_CAPTION
| WS_SYSMENU
| WS_THICKFRAME
| WS_MINIMIZEBOX
| WS_MAXIMIZEBOX
;
116 return CreateWindowExW(0, mciWndClassW
, NULL
,
117 dwStyle
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
,
119 hwndParent
, 0, hInstance
, (LPVOID
)szFile
);
122 /***********************************************************************
123 * MCIWndCreate [MSVFW32.@]
124 * MCIWndCreateA [MSVFW32.@]
126 HWND VFWAPIV
MCIWndCreateA(HWND hwndParent
, HINSTANCE hInstance
,
127 DWORD dwStyle
, LPCSTR szFile
)
130 UNICODE_STRING fileW
;
133 RtlCreateUnicodeStringFromAsciiz(&fileW
, szFile
);
137 ret
= MCIWndCreateW(hwndParent
, hInstance
, dwStyle
, fileW
.Buffer
);
139 RtlFreeUnicodeString(&fileW
);
143 static inline void MCIWND_notify_mode(MCIWndInfo
*mwi
)
145 if (mwi
->dwStyle
& MCIWNDF_NOTIFYMODE
)
147 UINT new_mode
= SendMessageW(mwi
->hWnd
, MCIWNDM_GETMODEW
, 0, 0);
148 if (new_mode
!= mwi
->mode
)
150 mwi
->mode
= new_mode
;
151 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYMODE
, (WPARAM
)mwi
->hWnd
, new_mode
);
156 static inline void MCIWND_notify_pos(MCIWndInfo
*mwi
)
158 if (mwi
->dwStyle
& MCIWNDF_NOTIFYPOS
)
160 LONG new_pos
= SendMessageW(mwi
->hWnd
, MCIWNDM_GETPOSITIONW
, 0, 0);
161 if (new_pos
!= mwi
->position
)
163 mwi
->position
= new_pos
;
164 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYPOS
, (WPARAM
)mwi
->hWnd
, new_pos
);
169 static inline void MCIWND_notify_size(MCIWndInfo
*mwi
)
171 if (mwi
->dwStyle
& MCIWNDF_NOTIFYSIZE
)
172 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYSIZE
, (WPARAM
)mwi
->hWnd
, 0);
175 static inline void MCIWND_notify_error(MCIWndInfo
*mwi
)
177 if (mwi
->dwStyle
& MCIWNDF_NOTIFYERROR
)
178 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYERROR
, (WPARAM
)mwi
->hWnd
, (LPARAM
)mwi
->lasterror
);
181 static void MCIWND_UpdateState(MCIWndInfo
*mwi
)
187 /* FIXME: get this from resources */
188 static const WCHAR no_deviceW
[] = {'N','o',' ','D','e','v','i','c','e',0};
189 SetWindowTextW(mwi
->hWnd
, no_deviceW
);
193 MCIWND_notify_pos(mwi
);
195 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
196 SendDlgItemMessageW(mwi
->hWnd
, CTL_TRACKBAR
, TBM_SETPOS
, TRUE
, mwi
->position
);
198 if (!(mwi
->dwStyle
& MCIWNDF_SHOWALL
))
201 if ((mwi
->dwStyle
& MCIWNDF_SHOWNAME
) && mwi
->lpName
)
202 lstrcpyW(buffer
, mwi
->lpName
);
206 if (mwi
->dwStyle
& (MCIWNDF_SHOWPOS
|MCIWNDF_SHOWMODE
))
208 static const WCHAR spaceW
[] = {' ',0};
209 static const WCHAR l_braceW
[] = {'(',0};
211 if (*buffer
) lstrcatW(buffer
, spaceW
);
212 lstrcatW(buffer
, l_braceW
);
215 if (mwi
->dwStyle
& MCIWNDF_SHOWPOS
)
220 SendMessageW(mwi
->hWnd
, MCIWNDM_GETPOSITIONW
, 64, (LPARAM
)posW
);
221 lstrcatW(buffer
, posW
);
224 if ((mwi
->dwStyle
& (MCIWNDF_SHOWPOS
|MCIWNDF_SHOWMODE
)) == (MCIWNDF_SHOWPOS
|MCIWNDF_SHOWMODE
))
226 static const WCHAR dashW
[] = {' ','-',' ',0};
227 lstrcatW(buffer
, dashW
);
230 if (mwi
->dwStyle
& MCIWNDF_SHOWMODE
)
235 SendMessageW(mwi
->hWnd
, MCIWNDM_GETMODEW
, 64, (LPARAM
)modeW
);
236 lstrcatW(buffer
, modeW
);
239 if (mwi
->dwStyle
& (MCIWNDF_SHOWPOS
|MCIWNDF_SHOWMODE
))
241 static const WCHAR r_braceW
[] = {')',0};
242 lstrcatW(buffer
, r_braceW
);
245 TRACE("=> %s\n", debugstr_w(buffer
));
246 SetWindowTextW(mwi
->hWnd
, buffer
);
249 static LRESULT
MCIWND_Create(HWND hWnd
, LPCREATESTRUCTW cs
)
253 static const WCHAR buttonW
[] = {'b','u','t','t','o','n',0};
255 mwi
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*mwi
));
258 SetWindowLongW(hWnd
, 0, (LPARAM
)mwi
);
260 mwi
->dwStyle
= cs
->style
;
261 /* There is no need to show stats if there is no caption */
262 if ((mwi
->dwStyle
& WS_CAPTION
) != WS_CAPTION
)
263 mwi
->dwStyle
&= ~MCIWNDF_SHOWALL
;
266 mwi
->hwndOwner
= cs
->hwndParent
;
267 mwi
->active_timer
= 500;
268 mwi
->inactive_timer
= 2000;
269 mwi
->mode
= MCI_MODE_NOT_READY
;
273 if (!(mwi
->dwStyle
& MCIWNDF_NOMENU
))
275 static const WCHAR menuW
[] = {'M','e','n','u',0};
277 hChld
= CreateWindowExW(0, buttonW
, menuW
, WS_CHILD
|WS_VISIBLE
, 32, cs
->cy
, 32, 32,
278 hWnd
, (HMENU
)CTL_MENU
, cs
->hInstance
, 0L);
279 TRACE("Get Button2: %p\n", hChld
);
282 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
284 INITCOMMONCONTROLSEX init
;
285 static const WCHAR playW
[] = {'P','l','a','y',0};
287 /* adding the other elements: play/stop button, menu button, status */
288 hChld
= CreateWindowExW(0, buttonW
, playW
, WS_CHILD
|WS_VISIBLE
, 0, cs
->cy
, 32, 32,
289 hWnd
, (HMENU
)CTL_PLAYSTOP
, cs
->hInstance
, 0L);
290 TRACE("Get Button1: %p\n", hChld
);
292 init
.dwSize
= sizeof(init
);
293 init
.dwICC
= ICC_BAR_CLASSES
;
294 InitCommonControlsEx(&init
);
296 hChld
= CreateWindowExW(0, TRACKBAR_CLASSW
, NULL
, WS_CHILD
|WS_VISIBLE
, 64, cs
->cy
, cs
->cx
- 64, 32,
297 hWnd
, (HMENU
)CTL_TRACKBAR
, cs
->hInstance
, 0L);
298 TRACE("Get status: %p\n", hChld
);
301 /* This sets the default window size */
302 SendMessageW(hWnd
, MCI_CLOSE
, 0, 0);
304 if (cs
->lpCreateParams
)
308 /* MCI wnd class is prepared to be embedded as an MDI child window */
309 if (cs
->dwExStyle
& WS_EX_MDICHILD
)
311 MDICREATESTRUCTW
*mdics
= cs
->lpCreateParams
;
312 lParam
= mdics
->lParam
;
315 lParam
= (LPARAM
)cs
->lpCreateParams
;
317 /* If it's our internal class pointer, file name is a unicode string */
318 if (cs
->lpszClass
== mciWndClassW
)
319 SendMessageW(hWnd
, MCIWNDM_OPENW
, 0, lParam
);
322 /* Otherwise let's try to figure out what string format is used */
323 HWND parent
= cs
->hwndParent
;
324 if (!parent
) parent
= GetWindow(hWnd
, GW_OWNER
);
326 SendMessageW(hWnd
, IsWindowUnicode(parent
) ? MCIWNDM_OPENW
: MCIWNDM_OPENA
, 0, lParam
);
333 static void MCIWND_ToggleState(MCIWndInfo
*mwi
)
335 switch (SendMessageW(mwi
->hWnd
, MCIWNDM_GETMODEW
, 0, 0))
337 case MCI_MODE_NOT_READY
:
338 case MCI_MODE_RECORD
:
341 TRACE("Cannot do much...\n");
345 SendMessageW(mwi
->hWnd
, MCI_RESUME
, 0, 0);
349 SendMessageW(mwi
->hWnd
, MCI_PAUSE
, 0, 0);
353 SendMessageW(mwi
->hWnd
, MCI_STOP
, 0, 0);
358 static LRESULT
MCIWND_Command(MCIWndInfo
*mwi
, WPARAM wParam
, LPARAM lParam
)
360 switch (LOWORD(wParam
))
362 case CTL_PLAYSTOP
: MCIWND_ToggleState(mwi
); break;
366 FIXME("support for command %04x not implement yet\n", LOWORD(wParam
));
371 static void MCIWND_notify_media(MCIWndInfo
*mwi
)
373 if (mwi
->dwStyle
& (MCIWNDF_NOTIFYMEDIAA
| MCIWNDF_NOTIFYMEDIAW
))
377 static const WCHAR empty_str
[1];
378 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYMEDIA
, (WPARAM
)mwi
->hWnd
, (LPARAM
)empty_str
);
382 if (mwi
->dwStyle
& MCIWNDF_NOTIFYANSI
)
387 len
= WideCharToMultiByte(CP_ACP
, 0, mwi
->lpName
, -1, NULL
, 0, NULL
, NULL
);
388 ansi_name
= HeapAlloc(GetProcessHeap(), 0, len
);
389 WideCharToMultiByte(CP_ACP
, 0, mwi
->lpName
, -1, ansi_name
, len
, NULL
, NULL
);
391 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYMEDIA
, (WPARAM
)mwi
->hWnd
, (LPARAM
)ansi_name
);
393 HeapFree(GetProcessHeap(), 0, ansi_name
);
396 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYMEDIA
, (WPARAM
)mwi
->hWnd
, (LPARAM
)mwi
->lpName
);
401 static MCIERROR
mci_generic_command(MCIWndInfo
*mwi
, UINT cmd
)
403 MCI_GENERIC_PARMS mci_generic
;
405 mci_generic
.dwCallback
= 0;
406 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, cmd
, 0, (DWORD_PTR
)&mci_generic
);
409 return mwi
->lasterror
;
411 MCIWND_notify_mode(mwi
);
412 MCIWND_UpdateState(mwi
);
416 static LRESULT
mci_get_devcaps(MCIWndInfo
*mwi
, UINT cap
)
418 MCI_GETDEVCAPS_PARMS mci_devcaps
;
420 mci_devcaps
.dwItem
= cap
;
421 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_GETDEVCAPS
,
423 (DWORD_PTR
)&mci_devcaps
);
427 return mci_devcaps
.dwReturn
;
430 static LRESULT
MCIWND_KeyDown(MCIWndInfo
*mwi
, UINT key
)
432 TRACE("%p, key %04x\n", mwi
->hWnd
, key
);
437 SendMessageW(mwi
->hWnd
, MCI_STOP
, 0, 0);
445 static LRESULT WINAPI
MCIWndProc(HWND hWnd
, UINT wMsg
, WPARAM wParam
, LPARAM lParam
)
449 TRACE("%p %04x %08lx %08lx\n", hWnd
, wMsg
, wParam
, lParam
);
451 mwi
= (MCIWndInfo
*)GetWindowLongPtrW(hWnd
, 0);
452 if (!mwi
&& wMsg
!= WM_CREATE
)
453 return DefWindowProcW(hWnd
, wMsg
, wParam
, lParam
);
458 MCIWND_Create(hWnd
, (CREATESTRUCTW
*)lParam
);
463 KillTimer(hWnd
, mwi
->uTimer
);
466 SendMessageW(hWnd
, MCI_CLOSE
, 0, 0);
468 HeapFree(GetProcessHeap(), 0, mwi
);
470 DestroyWindow(GetDlgItem(hWnd
, CTL_MENU
));
471 DestroyWindow(GetDlgItem(hWnd
, CTL_PLAYSTOP
));
472 DestroyWindow(GetDlgItem(hWnd
, CTL_TRACKBAR
));
477 MCI_DGV_UPDATE_PARMS mci_update
;
480 mci_update
.hDC
= (wParam
) ? (HDC
)wParam
: BeginPaint(hWnd
, &ps
);
482 mciSendCommandW(mwi
->mci
, MCI_UPDATE
,
483 MCI_DGV_UPDATE_HDC
| MCI_DGV_UPDATE_PAINT
,
484 (DWORD_PTR
)&mci_update
);
486 if (!wParam
) EndPaint(hWnd
, &ps
);
491 return MCIWND_Command(mwi
, wParam
, lParam
);
494 return MCIWND_KeyDown(mwi
, wParam
);
499 KillTimer(hWnd
, mwi
->uTimer
);
500 mwi
->uTimer
= SetTimer(hWnd
, 1, wParam
? mwi
->active_timer
: mwi
->inactive_timer
, NULL
);
505 MCIWND_UpdateState(mwi
);
509 SetWindowPos(GetDlgItem(hWnd
, CTL_PLAYSTOP
), 0, 0, HIWORD(lParam
) - 32, 0, 0, SWP_NOSIZE
| SWP_NOACTIVATE
);
510 SetWindowPos(GetDlgItem(hWnd
, CTL_MENU
), 0, 32, HIWORD(lParam
) - 32, 0, 0, SWP_NOSIZE
| SWP_NOACTIVATE
);
511 SetWindowPos(GetDlgItem(hWnd
, CTL_TRACKBAR
), 0, 64, HIWORD(lParam
) - 32, LOWORD(lParam
) - 64, 32, SWP_NOACTIVATE
);
513 if (!(mwi
->dwStyle
& MCIWNDF_NOAUTOSIZEMOVIE
))
517 rc
.left
= rc
.top
= 0;
518 rc
.right
= LOWORD(lParam
);
519 rc
.bottom
= HIWORD(lParam
);
520 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
521 rc
.bottom
-= 32; /* subtract the height of the playbar */
522 SendMessageW(hWnd
, MCIWNDM_PUT_DEST
, 0, (LPARAM
)&rc
);
524 MCIWND_notify_size(mwi
);
528 MCIWND_notify_mode(mwi
);
529 MCIWND_UpdateState(mwi
);
534 UNICODE_STRING nameW
;
535 TRACE("MCIWNDM_OPENA %s\n", debugstr_a((LPSTR
)lParam
));
536 RtlCreateUnicodeStringFromAsciiz(&nameW
, (LPCSTR
)lParam
);
537 lParam
= (LPARAM
)nameW
.Buffer
;
544 MCI_OPEN_PARMSW mci_open
;
545 MCI_GETDEVCAPS_PARMS mci_devcaps
;
547 WCHAR drv_name
[MAX_PATH
];
548 static const WCHAR formatW
[] = {'%','d',0};
549 static const WCHAR mci32W
[] = {'m','c','i','3','2',0};
550 static const WCHAR system_iniW
[] = {'s','y','s','t','e','m','.','i','n','i',0};
552 TRACE("MCIWNDM_OPENW %s\n", debugstr_w((LPWSTR
)lParam
));
554 if (wParam
== MCIWNDOPENF_NEW
)
556 SendMessageW(hWnd
, MCIWNDM_NEWW
, 0, lParam
);
557 goto end_of_mci_open
;
562 KillTimer(hWnd
, mwi
->uTimer
);
566 hCursor
= LoadCursorW(0, (LPWSTR
)IDC_WAIT
);
567 hCursor
= SetCursor(hCursor
);
569 mci_open
.lpstrElementName
= (LPWSTR
)lParam
;
570 wsprintfW(aliasW
, formatW
, HandleToLong(hWnd
) + 1);
571 mci_open
.lpstrAlias
= aliasW
;
572 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_OPEN
,
573 MCI_OPEN_ELEMENT
| MCI_OPEN_ALIAS
| MCI_WAIT
,
574 (DWORD_PTR
)&mci_open
);
577 if (mwi
->lasterror
&& !(mwi
->dwStyle
& MCIWNDF_NOERRORDLG
))
579 /* FIXME: get the caption from resources */
580 static const WCHAR caption
[] = {'M','C','I',' ','E','r','r','o','r',0};
581 WCHAR error_str
[MAXERRORLENGTH
];
583 mciGetErrorStringW(mwi
->lasterror
, error_str
, MAXERRORLENGTH
);
584 MessageBoxW(hWnd
, error_str
, caption
, MB_ICONEXCLAMATION
| MB_OK
);
585 MCIWND_notify_error(mwi
);
586 goto end_of_mci_open
;
589 mwi
->mci
= mci_open
.wDeviceID
;
590 mwi
->alias
= HandleToLong(hWnd
) + 1;
592 mwi
->lpName
= HeapAlloc(GetProcessHeap(), 0, (lstrlenW((LPWSTR
)lParam
) + 1) * sizeof(WCHAR
));
593 lstrcpyW(mwi
->lpName
, (LPWSTR
)lParam
);
595 MCIWND_UpdateState(mwi
);
597 mci_devcaps
.dwItem
= MCI_GETDEVCAPS_DEVICE_TYPE
;
598 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_GETDEVCAPS
,
600 (DWORD_PTR
)&mci_devcaps
);
603 MCIWND_notify_error(mwi
);
604 goto end_of_mci_open
;
607 mwi
->dev_type
= mci_devcaps
.dwReturn
;
610 SendMessageW(hWnd
, MCIWNDM_GETDEVICEW
, 256, (LPARAM
)drv_name
);
611 if (drv_name
[0] && GetPrivateProfileStringW(mci32W
, drv_name
, NULL
,
612 drv_name
, MAX_PATH
, system_iniW
))
613 mwi
->hdrv
= OpenDriver(drv_name
, NULL
, 0);
615 if (mwi
->dev_type
== MCI_DEVTYPE_DIGITAL_VIDEO
)
617 MCI_DGV_WINDOW_PARMSW mci_window
;
619 mci_window
.hWnd
= hWnd
;
620 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_WINDOW
,
622 (DWORD_PTR
)&mci_window
);
625 MCIWND_notify_error(mwi
);
626 goto end_of_mci_open
;
630 if (SendMessageW(hWnd
, MCIWNDM_GET_DEST
, 0, (LPARAM
)&rc
) == 0)
632 mwi
->size
.cx
= rc
.right
- rc
.left
;
633 mwi
->size
.cy
= rc
.bottom
- rc
.top
;
635 rc
.right
= MulDiv(mwi
->size
.cx
, mwi
->zoom
, 100);
636 rc
.bottom
= MulDiv(mwi
->size
.cy
, mwi
->zoom
, 100);
637 SendMessageW(hWnd
, MCIWNDM_PUT_DEST
, 0, (LPARAM
)&rc
);
641 GetClientRect(hWnd
, &rc
);
645 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
646 rc
.bottom
+= 32; /* add the height of the playbar */
647 AdjustWindowRect(&rc
, GetWindowLongW(hWnd
, GWL_STYLE
), FALSE
);
648 SetWindowPos(hWnd
, 0, 0, 0, rc
.right
- rc
.left
,
649 rc
.bottom
- rc
.top
, SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
651 SendDlgItemMessageW(hWnd
, CTL_TRACKBAR
, TBM_SETRANGEMIN
, 0L, 0L);
652 SendDlgItemMessageW(hWnd
, CTL_TRACKBAR
, TBM_SETRANGEMAX
, 1,
653 SendMessageW(hWnd
, MCIWNDM_GETLENGTH
, 0, 0));
654 mwi
->uTimer
= SetTimer(hWnd
, 1, mwi
->active_timer
, NULL
);
656 MCIWND_notify_media(mwi
);
659 if (wMsg
== MCIWNDM_OPENA
)
660 HeapFree(GetProcessHeap(), 0, (void *)lParam
);
661 return mwi
->lasterror
;
664 case MCIWNDM_GETDEVICEID
:
665 TRACE("MCIWNDM_GETDEVICEID\n");
668 case MCIWNDM_GETALIAS
:
669 TRACE("MCIWNDM_GETALIAS\n");
672 case MCIWNDM_GET_SOURCE
:
674 MCI_DGV_RECT_PARMS mci_rect
;
676 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_WHERE
,
677 MCI_DGV_WHERE_SOURCE
,
678 (DWORD_PTR
)&mci_rect
);
681 MCIWND_notify_error(mwi
);
682 return mwi
->lasterror
;
684 *(RECT
*)lParam
= mci_rect
.rc
;
685 TRACE("MCIWNDM_GET_SOURCE: %s\n", wine_dbgstr_rect(&mci_rect
.rc
));
689 case MCIWNDM_GET_DEST
:
691 MCI_DGV_RECT_PARMS mci_rect
;
693 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_WHERE
,
694 MCI_DGV_WHERE_DESTINATION
,
695 (DWORD_PTR
)&mci_rect
);
698 MCIWND_notify_error(mwi
);
699 return mwi
->lasterror
;
701 *(RECT
*)lParam
= mci_rect
.rc
;
702 TRACE("MCIWNDM_GET_DEST: %s\n", wine_dbgstr_rect(&mci_rect
.rc
));
706 case MCIWNDM_PUT_SOURCE
:
708 MCI_DGV_PUT_PARMS mci_put
;
710 mci_put
.rc
= *(RECT
*)lParam
;
711 TRACE("MCIWNDM_PUT_SOURCE: %s\n", wine_dbgstr_rect(&mci_put
.rc
));
712 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PUT
,
714 (DWORD_PTR
)&mci_put
);
717 MCIWND_notify_error(mwi
);
718 return mwi
->lasterror
;
723 case MCIWNDM_PUT_DEST
:
725 MCI_DGV_PUT_PARMS mci_put
;
727 mci_put
.rc
= *(RECT
*)lParam
;
728 TRACE("MCIWNDM_PUT_DEST: %s\n", wine_dbgstr_rect(&mci_put
.rc
));
730 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PUT
,
731 MCI_DGV_PUT_DESTINATION
| MCI_DGV_RECT
,
732 (DWORD_PTR
)&mci_put
);
735 MCIWND_notify_error(mwi
);
736 return mwi
->lasterror
;
741 case MCIWNDM_GETLENGTH
:
743 MCI_STATUS_PARMS mci_status
;
745 mci_status
.dwItem
= MCI_STATUS_LENGTH
;
746 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
748 (DWORD_PTR
)&mci_status
);
751 MCIWND_notify_error(mwi
);
754 TRACE("MCIWNDM_GETLENGTH: %ld\n", mci_status
.dwReturn
);
755 return mci_status
.dwReturn
;
758 case MCIWNDM_GETSTART
:
760 MCI_STATUS_PARMS mci_status
;
762 mci_status
.dwItem
= MCI_STATUS_POSITION
;
763 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
764 MCI_STATUS_ITEM
| MCI_STATUS_START
,
765 (DWORD_PTR
)&mci_status
);
768 MCIWND_notify_error(mwi
);
771 TRACE("MCIWNDM_GETSTART: %ld\n", mci_status
.dwReturn
);
772 return mci_status
.dwReturn
;
777 LRESULT start
, length
;
779 start
= SendMessageW(hWnd
, MCIWNDM_GETSTART
, 0, 0);
780 length
= SendMessageW(hWnd
, MCIWNDM_GETLENGTH
, 0, 0);
781 TRACE("MCIWNDM_GETEND: %ld\n", start
+ length
);
782 return (start
+ length
);
785 case MCIWNDM_GETPOSITIONA
:
786 case MCIWNDM_GETPOSITIONW
:
788 MCI_STATUS_PARMS mci_status
;
790 TRACE("MCIWNDM_GETPOSITION\n");
792 /* get position string if requested */
793 if (wParam
&& lParam
)
795 if (wMsg
== MCIWNDM_GETPOSITIONA
)
799 wsprintfA(cmd
, "status %d position", mwi
->alias
);
800 mwi
->lasterror
= mciSendStringA(cmd
, (LPSTR
)lParam
, wParam
, 0);
806 static const WCHAR formatW
[] = {'s','t','a','t','u','s',' ','%','d',' ','p','o','s','i','t','i','o','n',0};
808 wsprintfW(cmdW
, formatW
, mwi
->alias
);
809 mwi
->lasterror
= mciSendStringW(cmdW
, (LPWSTR
)lParam
, wParam
, 0);
816 mci_status
.dwItem
= MCI_STATUS_POSITION
;
817 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
819 (DWORD_PTR
)&mci_status
);
823 return mci_status
.dwReturn
;
826 case MCIWNDM_GETMODEA
:
827 case MCIWNDM_GETMODEW
:
829 MCI_STATUS_PARMS mci_status
;
831 TRACE("MCIWNDM_GETMODE\n");
834 return MCI_MODE_NOT_READY
;
836 /* get mode string if requested */
837 if (wParam
&& lParam
)
839 if (wMsg
== MCIWNDM_GETMODEA
)
843 wsprintfA(cmd
, "status %d mode", mwi
->alias
);
844 mwi
->lasterror
= mciSendStringA(cmd
, (LPSTR
)lParam
, wParam
, 0);
850 static const WCHAR formatW
[] = {'s','t','a','t','u','s',' ','%','d',' ','m','o','d','e',0};
852 wsprintfW(cmdW
, formatW
, mwi
->alias
);
853 mwi
->lasterror
= mciSendStringW(cmdW
, (LPWSTR
)lParam
, wParam
, 0);
857 return MCI_MODE_NOT_READY
;
860 mci_status
.dwItem
= MCI_STATUS_MODE
;
861 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
863 (DWORD_PTR
)&mci_status
);
865 return MCI_MODE_NOT_READY
;
867 return mci_status
.dwReturn
;
870 case MCIWNDM_PLAYFROM
:
872 MCI_PLAY_PARMS mci_play
;
874 TRACE("MCIWNDM_PLAYFROM %08lx\n", lParam
);
876 mci_play
.dwCallback
= (DWORD_PTR
)hWnd
;
877 mci_play
.dwFrom
= lParam
;
878 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PLAY
,
879 MCI_FROM
| MCI_NOTIFY
,
880 (DWORD_PTR
)&mci_play
);
883 MCIWND_notify_error(mwi
);
884 return mwi
->lasterror
;
887 MCIWND_notify_mode(mwi
);
888 MCIWND_UpdateState(mwi
);
894 MCI_PLAY_PARMS mci_play
;
896 TRACE("MCIWNDM_PLAYTO %08lx\n", lParam
);
898 mci_play
.dwCallback
= (DWORD_PTR
)hWnd
;
899 mci_play
.dwTo
= lParam
;
900 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PLAY
,
902 (DWORD_PTR
)&mci_play
);
905 MCIWND_notify_error(mwi
);
906 return mwi
->lasterror
;
909 MCIWND_notify_mode(mwi
);
910 MCIWND_UpdateState(mwi
);
914 case MCIWNDM_PLAYREVERSE
:
916 MCI_PLAY_PARMS mci_play
;
917 DWORD flags
= MCI_NOTIFY
;
919 TRACE("MCIWNDM_PLAYREVERSE %08lx\n", lParam
);
921 mci_play
.dwCallback
= (DWORD_PTR
)hWnd
;
922 mci_play
.dwFrom
= lParam
;
923 switch (mwi
->dev_type
)
926 case MCI_DEVTYPE_ANIMATION
:
927 flags
|= MCI_ANIM_PLAY_REVERSE
;
930 case MCI_DEVTYPE_DIGITAL_VIDEO
:
931 flags
|= MCI_DGV_PLAY_REVERSE
;
934 #ifdef MCI_VCR_PLAY_REVERSE
935 case MCI_DEVTYPE_VCR
:
936 flags
|= MCI_VCR_PLAY_REVERSE
;
940 case MCI_DEVTYPE_VIDEODISC
:
941 flags
|= MCI_VD_PLAY_REVERSE
;
945 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PLAY
,
946 flags
, (DWORD_PTR
)&mci_play
);
949 MCIWND_notify_error(mwi
);
950 return mwi
->lasterror
;
953 MCIWND_notify_mode(mwi
);
954 MCIWND_UpdateState(mwi
);
958 case MCIWNDM_GETERRORA
:
959 mciGetErrorStringA(mwi
->lasterror
, (LPSTR
)lParam
, wParam
);
960 TRACE("MCIWNDM_GETERRORA: %s\n", debugstr_an((LPSTR
)lParam
, wParam
));
961 return mwi
->lasterror
;
963 case MCIWNDM_GETERRORW
:
964 mciGetErrorStringW(mwi
->lasterror
, (LPWSTR
)lParam
, wParam
);
965 TRACE("MCIWNDM_GETERRORW: %s\n", debugstr_wn((LPWSTR
)lParam
, wParam
));
966 return mwi
->lasterror
;
968 case MCIWNDM_SETOWNER
:
969 TRACE("MCIWNDM_SETOWNER %p\n", (HWND
)wParam
);
970 mwi
->hwndOwner
= (HWND
)wParam
;
973 case MCIWNDM_SENDSTRINGA
:
975 UNICODE_STRING stringW
;
977 TRACE("MCIWNDM_SENDSTRINGA %s\n", debugstr_a((LPCSTR
)lParam
));
979 RtlCreateUnicodeStringFromAsciiz(&stringW
, (LPCSTR
)lParam
);
980 lParam
= (LPARAM
)stringW
.Buffer
;
983 case MCIWNDM_SENDSTRINGW
:
987 TRACE("MCIWNDM_SENDSTRINGW %s\n", debugstr_w((LPCWSTR
)lParam
));
989 p
= wcschr((LPCWSTR
)lParam
, ' ');
992 static const WCHAR formatW
[] = {'%','d',' ',0};
995 pos
= p
- (WCHAR
*)lParam
+ 1;
996 len
= lstrlenW((LPCWSTR
)lParam
) + 64;
998 cmdW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
1000 memcpy(cmdW
, (void *)lParam
, pos
* sizeof(WCHAR
));
1001 wsprintfW(cmdW
+ pos
, formatW
, mwi
->alias
);
1002 lstrcatW(cmdW
, (WCHAR
*)lParam
+ pos
);
1005 cmdW
= (LPWSTR
)lParam
;
1007 mwi
->lasterror
= mciSendStringW(cmdW
, mwi
->return_string
,
1008 ARRAY_SIZE(mwi
->return_string
), 0);
1010 MCIWND_notify_error(mwi
);
1012 if (cmdW
!= (LPWSTR
)lParam
)
1013 HeapFree(GetProcessHeap(), 0, cmdW
);
1015 if (wMsg
== MCIWNDM_SENDSTRINGA
)
1016 HeapFree(GetProcessHeap(), 0, (void *)lParam
);
1018 MCIWND_UpdateState(mwi
);
1019 return mwi
->lasterror
;
1022 case MCIWNDM_RETURNSTRINGA
:
1023 WideCharToMultiByte(CP_ACP
, 0, mwi
->return_string
, -1, (LPSTR
)lParam
, wParam
, NULL
, NULL
);
1024 TRACE("MCIWNDM_RETURNTRINGA %s\n", debugstr_an((LPSTR
)lParam
, wParam
));
1025 return mwi
->lasterror
;
1027 case MCIWNDM_RETURNSTRINGW
:
1028 lstrcpynW((LPWSTR
)lParam
, mwi
->return_string
, wParam
);
1029 TRACE("MCIWNDM_RETURNTRINGW %s\n", debugstr_wn((LPWSTR
)lParam
, wParam
));
1030 return mwi
->lasterror
;
1032 case MCIWNDM_SETTIMERS
:
1033 TRACE("MCIWNDM_SETTIMERS active %d ms, inactive %d ms\n", (int)wParam
, (int)lParam
);
1034 mwi
->active_timer
= (WORD
)wParam
;
1035 mwi
->inactive_timer
= (WORD
)lParam
;
1038 case MCIWNDM_SETACTIVETIMER
:
1039 TRACE("MCIWNDM_SETACTIVETIMER %d ms\n", (int)wParam
);
1040 mwi
->active_timer
= (WORD
)wParam
;
1043 case MCIWNDM_SETINACTIVETIMER
:
1044 TRACE("MCIWNDM_SETINACTIVETIMER %d ms\n", (int)wParam
);
1045 mwi
->inactive_timer
= (WORD
)wParam
;
1048 case MCIWNDM_GETACTIVETIMER
:
1049 TRACE("MCIWNDM_GETACTIVETIMER: %d ms\n", mwi
->active_timer
);
1050 return mwi
->active_timer
;
1052 case MCIWNDM_GETINACTIVETIMER
:
1053 TRACE("MCIWNDM_GETINACTIVETIMER: %d ms\n", mwi
->inactive_timer
);
1054 return mwi
->inactive_timer
;
1056 case MCIWNDM_CHANGESTYLES
:
1057 TRACE("MCIWNDM_CHANGESTYLES mask %08lx, set %08lx\n", wParam
, lParam
);
1058 /* FIXME: update the visual window state as well:
1059 * add/remove trackbar, autosize, etc.
1061 mwi
->dwStyle
&= ~wParam
;
1062 mwi
->dwStyle
|= lParam
& wParam
;
1065 case MCIWNDM_GETSTYLES
:
1066 TRACE("MCIWNDM_GETSTYLES: %08x\n", mwi
->dwStyle
& 0xffff);
1067 return mwi
->dwStyle
& 0xffff;
1069 case MCIWNDM_GETDEVICEA
:
1072 char *str
= (char *)lParam
;
1073 MCI_SYSINFO_PARMSA mci_sysinfo
;
1075 mci_sysinfo
.lpstrReturn
= str
;
1076 mci_sysinfo
.dwRetSize
= wParam
;
1077 mwi
->lasterror
= mciSendCommandA(mwi
->mci
, MCI_SYSINFO
,
1078 MCI_SYSINFO_INSTALLNAME
,
1079 (DWORD_PTR
)&mci_sysinfo
);
1080 while(len
< wParam
&& str
[len
]) len
++;
1081 TRACE("MCIWNDM_GETDEVICEA: %s\n", debugstr_an(str
, len
));
1085 case MCIWNDM_GETDEVICEW
:
1088 WCHAR
*str
= (WCHAR
*)lParam
;
1089 MCI_SYSINFO_PARMSW mci_sysinfo
;
1091 mci_sysinfo
.lpstrReturn
= str
;
1092 mci_sysinfo
.dwRetSize
= wParam
;
1093 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_SYSINFO
,
1094 MCI_SYSINFO_INSTALLNAME
,
1095 (DWORD_PTR
)&mci_sysinfo
);
1096 while(len
< wParam
&& str
[len
]) len
++;
1097 TRACE("MCIWNDM_GETDEVICEW: %s\n", debugstr_wn(str
, len
));
1101 case MCIWNDM_VALIDATEMEDIA
:
1102 TRACE("MCIWNDM_VALIDATEMEDIA\n");
1105 SendMessageW(hWnd
, MCIWNDM_GETSTART
, 0, 0);
1106 SendMessageW(hWnd
, MCIWNDM_GETLENGTH
, 0, 0);
1110 case MCIWNDM_GETFILENAMEA
:
1111 TRACE("MCIWNDM_GETFILENAMEA: %s\n", debugstr_w(mwi
->lpName
));
1113 WideCharToMultiByte(CP_ACP
, 0, mwi
->lpName
, -1, (LPSTR
)lParam
, wParam
, NULL
, NULL
);
1116 case MCIWNDM_GETFILENAMEW
:
1117 TRACE("MCIWNDM_GETFILENAMEW: %s\n", debugstr_w(mwi
->lpName
));
1119 lstrcpynW((LPWSTR
)lParam
, mwi
->lpName
, wParam
);
1122 case MCIWNDM_GETTIMEFORMATA
:
1123 case MCIWNDM_GETTIMEFORMATW
:
1125 MCI_STATUS_PARMS mci_status
;
1127 TRACE("MCIWNDM_GETTIMEFORMAT %08lx %08lx\n", wParam
, lParam
);
1129 /* get format string if requested */
1130 if (wParam
&& lParam
)
1132 if (wMsg
== MCIWNDM_GETTIMEFORMATA
)
1136 wsprintfA(cmd
, "status %d time format", mwi
->alias
);
1137 mwi
->lasterror
= mciSendStringA(cmd
, (LPSTR
)lParam
, wParam
, 0);
1144 static const WCHAR formatW
[] = {'s','t','a','t','u','s',' ','%','d',' ','t','i','m','e',' ','f','o','r','m','a','t',0};
1146 wsprintfW(cmdW
, formatW
, mwi
->alias
);
1147 mwi
->lasterror
= mciSendStringW(cmdW
, (LPWSTR
)lParam
, wParam
, 0);
1153 mci_status
.dwItem
= MCI_STATUS_TIME_FORMAT
;
1154 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
1156 (DWORD_PTR
)&mci_status
);
1160 return mci_status
.dwReturn
;
1163 case MCIWNDM_SETTIMEFORMATA
:
1165 UNICODE_STRING stringW
;
1167 TRACE("MCIWNDM_SETTIMEFORMATA %s\n", debugstr_a((LPSTR
)lParam
));
1169 RtlCreateUnicodeStringFromAsciiz(&stringW
, (LPCSTR
)lParam
);
1170 lParam
= (LPARAM
)stringW
.Buffer
;
1173 case MCIWNDM_SETTIMEFORMATW
:
1175 static const WCHAR formatW
[] = {'s','e','t',' ','%','d',' ','t','i','m','e',' ','f','o','r','m','a','t',' ',0};
1178 TRACE("MCIWNDM_SETTIMEFORMATW %s\n", debugstr_w((LPWSTR
)lParam
));
1182 cmdW
= HeapAlloc(GetProcessHeap(), 0, (lstrlenW((LPCWSTR
)lParam
) + 64) * sizeof(WCHAR
));
1183 wsprintfW(cmdW
, formatW
, mwi
->alias
);
1184 lstrcatW(cmdW
, (WCHAR
*)lParam
);
1186 mwi
->lasterror
= mciSendStringW(cmdW
, NULL
, 0, 0);
1188 /* fix the range tracking according to the new time format */
1189 if (!mwi
->lasterror
)
1190 SendDlgItemMessageW(hWnd
, CTL_TRACKBAR
, TBM_SETRANGEMAX
, 1,
1191 SendMessageW(hWnd
, MCIWNDM_GETLENGTH
, 0, 0));
1193 HeapFree(GetProcessHeap(), 0, cmdW
);
1196 if (wMsg
== MCIWNDM_SETTIMEFORMATA
)
1197 HeapFree(GetProcessHeap(), 0, (void *)lParam
);
1202 case MCIWNDM_CAN_PLAY
:
1203 TRACE("MCIWNDM_CAN_PLAY\n");
1205 return mci_get_devcaps(mwi
, MCI_GETDEVCAPS_CAN_PLAY
);
1208 case MCIWNDM_CAN_RECORD
:
1209 TRACE("MCIWNDM_CAN_RECORD\n");
1211 return mci_get_devcaps(mwi
, MCI_GETDEVCAPS_CAN_RECORD
);
1214 case MCIWNDM_CAN_SAVE
:
1215 TRACE("MCIWNDM_CAN_SAVE\n");
1217 return mci_get_devcaps(mwi
, MCI_GETDEVCAPS_CAN_SAVE
);
1220 case MCIWNDM_CAN_EJECT
:
1221 TRACE("MCIWNDM_CAN_EJECT\n");
1223 return mci_get_devcaps(mwi
, MCI_GETDEVCAPS_CAN_EJECT
);
1226 case MCIWNDM_CAN_WINDOW
:
1227 TRACE("MCIWNDM_CAN_WINDOW\n");
1228 switch (mwi
->dev_type
)
1230 case MCI_DEVTYPE_ANIMATION
:
1231 case MCI_DEVTYPE_DIGITAL_VIDEO
:
1232 case MCI_DEVTYPE_OVERLAY
:
1237 case MCIWNDM_CAN_CONFIG
:
1238 TRACE("MCIWNDM_CAN_CONFIG\n");
1240 return SendDriverMessage(mwi
->hdrv
, DRV_QUERYCONFIGURE
, 0, 0);
1243 case MCIWNDM_SETZOOM
:
1244 TRACE("MCIWNDM_SETZOOM %ld\n", lParam
);
1247 if (mwi
->mci
&& !(mwi
->dwStyle
& MCIWNDF_NOAUTOSIZEWINDOW
))
1251 rc
.left
= rc
.top
= 0;
1252 rc
.right
= MulDiv(mwi
->size
.cx
, mwi
->zoom
, 100);
1253 rc
.bottom
= MulDiv(mwi
->size
.cy
, mwi
->zoom
, 100);
1255 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
1256 rc
.bottom
+= 32; /* add the height of the playbar */
1257 AdjustWindowRect(&rc
, GetWindowLongW(hWnd
, GWL_STYLE
), FALSE
);
1258 SetWindowPos(hWnd
, 0, 0, 0, rc
.right
- rc
.left
, rc
.bottom
- rc
.top
,
1259 SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
1263 case MCIWNDM_GETZOOM
:
1264 TRACE("MCIWNDM_GETZOOM: %d\n", mwi
->zoom
);
1269 MCI_SET_PARMS mci_set
;
1271 TRACE("MCIWNDM_EJECT\n");
1273 mci_set
.dwCallback
= (DWORD_PTR
)hWnd
;
1274 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_SET
,
1275 MCI_SET_DOOR_OPEN
| MCI_NOTIFY
,
1276 (DWORD_PTR
)&mci_set
);
1277 MCIWND_notify_mode(mwi
);
1278 MCIWND_UpdateState(mwi
);
1279 return mwi
->lasterror
;
1282 case MCIWNDM_SETVOLUME
:
1283 case MCIWNDM_GETVOLUME
:
1284 case MCIWNDM_SETSPEED
:
1285 case MCIWNDM_GETSPEED
:
1286 case MCIWNDM_SETREPEAT
:
1287 case MCIWNDM_GETREPEAT
:
1288 case MCIWNDM_REALIZE
:
1289 case MCIWNDM_GETPALETTE
:
1290 case MCIWNDM_SETPALETTE
:
1293 case MCIWNDM_PALETTEKICK
:
1294 case MCIWNDM_OPENINTERFACE
:
1295 FIXME("support for MCIWNDM_ message WM_USER+%d not implemented\n", wMsg
- WM_USER
);
1300 LRESULT end
= SendMessageW(hWnd
, MCIWNDM_GETEND
, 0, 0);
1301 return SendMessageW(hWnd
, MCIWNDM_PLAYTO
, 0, end
);
1307 MCI_SEEK_PARMS mci_seek
; /* Layout is usable as MCI_XYZ_STEP_PARMS */
1308 DWORD flags
= MCI_STEP
== wMsg
? 0 :
1309 MCIWND_START
== lParam
? MCI_SEEK_TO_START
:
1310 MCIWND_END
== lParam
? MCI_SEEK_TO_END
: MCI_TO
;
1312 mci_seek
.dwTo
= lParam
;
1313 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, wMsg
,
1314 flags
, (DWORD_PTR
)&mci_seek
);
1317 MCIWND_notify_error(mwi
);
1318 return mwi
->lasterror
;
1320 /* update window to reflect the state */
1321 else InvalidateRect(hWnd
, NULL
, TRUE
);
1328 MCI_GENERIC_PARMS mci_generic
;
1332 CloseDriver(mwi
->hdrv
, 0, 0);
1338 mci_generic
.dwCallback
= 0;
1339 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_CLOSE
,
1340 0, (DWORD_PTR
)&mci_generic
);
1344 mwi
->mode
= MCI_MODE_NOT_READY
;
1347 HeapFree(GetProcessHeap(), 0, mwi
->lpName
);
1349 MCIWND_UpdateState(mwi
);
1351 GetClientRect(hWnd
, &rc
);
1353 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
1354 rc
.bottom
+= 32; /* add the height of the playbar */
1355 AdjustWindowRect(&rc
, GetWindowLongW(hWnd
, GWL_STYLE
), FALSE
);
1356 SetWindowPos(hWnd
, 0, 0, 0, rc
.right
- rc
.left
,
1357 rc
.bottom
- rc
.top
, SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
1359 MCIWND_notify_media(mwi
);
1366 mci_generic_command(mwi
, wMsg
);
1367 return mwi
->lasterror
;
1371 SendDriverMessage(mwi
->hdrv
, DRV_CONFIGURE
, (LPARAM
)hWnd
, 0);
1382 case MCI_GETDEVCAPS
:
1400 /*case MCI_SETTIMECODE:*/
1401 /*case MCI_SETTUNER:*/
1412 FIXME("support for MCI_ command %04x not implemented\n", wMsg
);
1416 if (wMsg
>= WM_USER
)
1418 FIXME("support for MCIWNDM_ message WM_USER+%d not implemented\n", wMsg
- WM_USER
);
1422 if (GetWindowLongW(hWnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
1423 return DefMDIChildProcW(hWnd
, wMsg
, wParam
, lParam
);
1425 return DefWindowProcW(hWnd
, wMsg
, wParam
, lParam
);