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.
24 #include "msvideo_private.h"
29 #include <wine/unicode.h>
31 WINE_DEFAULT_DEBUG_CHANNEL(mci
);
33 extern HMODULE MSVFW32_hModule
;
34 static const WCHAR mciWndClassW
[] = {'M','C','I','W','n','d','C','l','a','s','s',0};
45 SIZE size
; /* size of the original frame rect */
51 WCHAR return_string
[128];
52 WORD active_timer
, inactive_timer
;
55 static LRESULT WINAPI
MCIWndProc(HWND hWnd
, UINT wMsg
, WPARAM wParam
, LPARAM lParam
);
57 #define CTL_PLAYSTOP 0x3200
58 #define CTL_MENU 0x3201
59 #define CTL_TRACKBAR 0x3202
61 /***********************************************************************
62 * MCIWndRegisterClass [MSVFW32.@]
64 * NOTE: Native always uses its own hInstance
66 BOOL VFWAPIV
MCIWndRegisterClass(void)
70 /* Since we are going to register a class belonging to MSVFW32
71 * and later we will create windows with a different hInstance
72 * CS_GLOBALCLASS is needed. And because the second attempt
73 * to register a global class will fail we need to test whether
74 * the class was already registered.
76 wc
.style
= CS_VREDRAW
| CS_HREDRAW
| CS_DBLCLKS
| CS_OWNDC
| CS_GLOBALCLASS
;
77 wc
.lpfnWndProc
= MCIWndProc
;
79 wc
.cbWndExtra
= sizeof(MCIWndInfo
*);
80 wc
.hInstance
= MSVFW32_hModule
;
82 wc
.hCursor
= LoadCursorW(0, MAKEINTRESOURCEW(IDC_ARROW
));
83 wc
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+ 1);
84 wc
.lpszMenuName
= NULL
;
85 wc
.lpszClassName
= mciWndClassW
;
87 if (RegisterClassW(&wc
)) return TRUE
;
88 if (GetLastError() == ERROR_CLASS_ALREADY_EXISTS
) return TRUE
;
93 /***********************************************************************
94 * MCIWndCreateW [MSVFW32.@]
96 HWND VFWAPIV
MCIWndCreateW(HWND hwndParent
, HINSTANCE hInstance
,
97 DWORD dwStyle
, LPCWSTR szFile
)
99 TRACE("%p %p %x %s\n", hwndParent
, hInstance
, dwStyle
, debugstr_w(szFile
));
101 MCIWndRegisterClass();
103 if (!hInstance
) hInstance
= GetModuleHandleW(0);
106 dwStyle
|= WS_VISIBLE
| WS_BORDER
/*| WS_CHILD*/;
108 dwStyle
|= WS_VISIBLE
| WS_CAPTION
| WS_SYSMENU
| WS_THICKFRAME
| WS_MINIMIZEBOX
| WS_MAXIMIZEBOX
;
110 return CreateWindowExW(0, mciWndClassW
, NULL
,
111 dwStyle
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
,
113 hwndParent
, 0, hInstance
, (LPVOID
)szFile
);
116 /***********************************************************************
117 * MCIWndCreate [MSVFW32.@]
118 * MCIWndCreateA [MSVFW32.@]
120 HWND VFWAPIV
MCIWndCreateA(HWND hwndParent
, HINSTANCE hInstance
,
121 DWORD dwStyle
, LPCSTR szFile
)
124 UNICODE_STRING fileW
;
127 RtlCreateUnicodeStringFromAsciiz(&fileW
, szFile
);
131 ret
= MCIWndCreateW(hwndParent
, hInstance
, dwStyle
, fileW
.Buffer
);
133 RtlFreeUnicodeString(&fileW
);
137 static inline void MCIWND_notify_mode(MCIWndInfo
*mwi
)
139 if (mwi
->dwStyle
& MCIWNDF_NOTIFYMODE
)
141 UINT new_mode
= SendMessageW(mwi
->hWnd
, MCIWNDM_GETMODEW
, 0, 0);
142 if (new_mode
!= mwi
->mode
)
144 mwi
->mode
= new_mode
;
145 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYMODE
, (WPARAM
)mwi
->hWnd
, new_mode
);
150 static inline void MCIWND_notify_pos(MCIWndInfo
*mwi
)
152 if (mwi
->dwStyle
& MCIWNDF_NOTIFYPOS
)
154 LONG new_pos
= SendMessageW(mwi
->hWnd
, MCIWNDM_GETPOSITIONW
, 0, 0);
155 if (new_pos
!= mwi
->position
)
157 mwi
->position
= new_pos
;
158 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYPOS
, (WPARAM
)mwi
->hWnd
, new_pos
);
163 static inline void MCIWND_notify_size(MCIWndInfo
*mwi
)
165 if (mwi
->dwStyle
& MCIWNDF_NOTIFYSIZE
)
166 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYSIZE
, (WPARAM
)mwi
->hWnd
, 0);
169 static inline void MCIWND_notify_error(MCIWndInfo
*mwi
)
171 if (mwi
->dwStyle
& MCIWNDF_NOTIFYERROR
)
172 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYERROR
, (WPARAM
)mwi
->hWnd
, (LPARAM
)mwi
->lasterror
);
175 static void MCIWND_UpdateState(MCIWndInfo
*mwi
)
181 /* FIXME: get this from resources */
182 static const WCHAR no_deviceW
[] = {'N','o',' ','D','e','v','i','c','e',0};
183 SetWindowTextW(mwi
->hWnd
, no_deviceW
);
187 MCIWND_notify_pos(mwi
);
189 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
190 SendDlgItemMessageW(mwi
->hWnd
, CTL_TRACKBAR
, TBM_SETPOS
, TRUE
, mwi
->position
);
192 if (!(mwi
->dwStyle
& MCIWNDF_SHOWALL
))
195 if ((mwi
->dwStyle
& MCIWNDF_SHOWNAME
) && mwi
->lpName
)
196 strcpyW(buffer
, mwi
->lpName
);
200 if (mwi
->dwStyle
& (MCIWNDF_SHOWPOS
|MCIWNDF_SHOWMODE
))
202 static const WCHAR spaceW
[] = {' ',0};
203 static const WCHAR l_braceW
[] = {'(',0};
205 if (*buffer
) strcatW(buffer
, spaceW
);
206 strcatW(buffer
, l_braceW
);
209 if (mwi
->dwStyle
& MCIWNDF_SHOWPOS
)
214 SendMessageW(mwi
->hWnd
, MCIWNDM_GETPOSITIONW
, 64, (LPARAM
)posW
);
215 strcatW(buffer
, posW
);
218 if ((mwi
->dwStyle
& (MCIWNDF_SHOWPOS
|MCIWNDF_SHOWMODE
)) == (MCIWNDF_SHOWPOS
|MCIWNDF_SHOWMODE
))
220 static const WCHAR dashW
[] = {' ','-',' ',0};
221 strcatW(buffer
, dashW
);
224 if (mwi
->dwStyle
& MCIWNDF_SHOWMODE
)
229 SendMessageW(mwi
->hWnd
, MCIWNDM_GETMODEW
, 64, (LPARAM
)modeW
);
230 strcatW(buffer
, modeW
);
233 if (mwi
->dwStyle
& (MCIWNDF_SHOWPOS
|MCIWNDF_SHOWMODE
))
235 static const WCHAR r_braceW
[] = {')',0};
236 strcatW(buffer
, r_braceW
);
239 TRACE("=> %s\n", debugstr_w(buffer
));
240 SetWindowTextW(mwi
->hWnd
, buffer
);
243 static LRESULT
MCIWND_Create(HWND hWnd
, LPCREATESTRUCTW cs
)
247 static const WCHAR buttonW
[] = {'b','u','t','t','o','n',0};
249 mwi
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*mwi
));
252 SetWindowLongW(hWnd
, 0, (LPARAM
)mwi
);
254 mwi
->dwStyle
= cs
->style
;
255 /* There is no need to show stats if there is no caption */
256 if ((mwi
->dwStyle
& WS_CAPTION
) != WS_CAPTION
)
257 mwi
->dwStyle
&= ~MCIWNDF_SHOWALL
;
260 mwi
->hwndOwner
= cs
->hwndParent
;
261 mwi
->active_timer
= 500;
262 mwi
->inactive_timer
= 2000;
263 mwi
->mode
= MCI_MODE_NOT_READY
;
267 if (!(mwi
->dwStyle
& MCIWNDF_NOMENU
))
269 static const WCHAR menuW
[] = {'M','e','n','u',0};
271 hChld
= CreateWindowExW(0, buttonW
, menuW
, WS_CHILD
|WS_VISIBLE
, 32, cs
->cy
, 32, 32,
272 hWnd
, (HMENU
)CTL_MENU
, cs
->hInstance
, 0L);
273 TRACE("Get Button2: %p\n", hChld
);
276 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
278 INITCOMMONCONTROLSEX init
;
279 static const WCHAR playW
[] = {'P','l','a','y',0};
281 /* adding the other elements: play/stop button, menu button, status */
282 hChld
= CreateWindowExW(0, buttonW
, playW
, WS_CHILD
|WS_VISIBLE
, 0, cs
->cy
, 32, 32,
283 hWnd
, (HMENU
)CTL_PLAYSTOP
, cs
->hInstance
, 0L);
284 TRACE("Get Button1: %p\n", hChld
);
286 init
.dwSize
= sizeof(init
);
287 init
.dwICC
= ICC_BAR_CLASSES
;
288 InitCommonControlsEx(&init
);
290 hChld
= CreateWindowExW(0, TRACKBAR_CLASSW
, NULL
, WS_CHILD
|WS_VISIBLE
, 64, cs
->cy
, cs
->cx
- 64, 32,
291 hWnd
, (HMENU
)CTL_TRACKBAR
, cs
->hInstance
, 0L);
292 TRACE("Get status: %p\n", hChld
);
295 /* This sets the default window size */
296 SendMessageW(hWnd
, MCI_CLOSE
, 0, 0);
298 if (cs
->lpCreateParams
)
302 /* MCI wnd class is prepared to be embedded as an MDI child window */
303 if (cs
->dwExStyle
& WS_EX_MDICHILD
)
305 MDICREATESTRUCTW
*mdics
= cs
->lpCreateParams
;
306 lParam
= mdics
->lParam
;
309 lParam
= (LPARAM
)cs
->lpCreateParams
;
311 /* If it's our internal class pointer, file name is a unicode string */
312 if (cs
->lpszClass
== mciWndClassW
)
313 SendMessageW(hWnd
, MCIWNDM_OPENW
, 0, lParam
);
316 /* Otherwise let's try to figure out what string format is used */
317 HWND parent
= cs
->hwndParent
;
318 if (!parent
) parent
= GetWindow(hWnd
, GW_OWNER
);
320 SendMessageW(hWnd
, IsWindowUnicode(parent
) ? MCIWNDM_OPENW
: MCIWNDM_OPENA
, 0, lParam
);
327 static void MCIWND_ToggleState(MCIWndInfo
*mwi
)
329 switch (SendMessageW(mwi
->hWnd
, MCIWNDM_GETMODEW
, 0, 0))
331 case MCI_MODE_NOT_READY
:
332 case MCI_MODE_RECORD
:
335 TRACE("Cannot do much...\n");
339 SendMessageW(mwi
->hWnd
, MCI_RESUME
, 0, 0);
343 SendMessageW(mwi
->hWnd
, MCI_PAUSE
, 0, 0);
347 SendMessageW(mwi
->hWnd
, MCI_STOP
, 0, 0);
352 static LRESULT
MCIWND_Command(MCIWndInfo
*mwi
, WPARAM wParam
, LPARAM lParam
)
354 switch (LOWORD(wParam
))
356 case CTL_PLAYSTOP
: MCIWND_ToggleState(mwi
); break;
360 FIXME("support for command %04x not implement yet\n", LOWORD(wParam
));
365 static void MCIWND_notify_media(MCIWndInfo
*mwi
)
367 if (mwi
->dwStyle
& (MCIWNDF_NOTIFYMEDIAA
| MCIWNDF_NOTIFYMEDIAW
))
371 static const WCHAR empty_str
[1];
372 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYMEDIA
, (WPARAM
)mwi
->hWnd
, (LPARAM
)empty_str
);
376 if (mwi
->dwStyle
& MCIWNDF_NOTIFYANSI
)
381 len
= WideCharToMultiByte(CP_ACP
, 0, mwi
->lpName
, -1, NULL
, 0, NULL
, NULL
);
382 ansi_name
= HeapAlloc(GetProcessHeap(), 0, len
);
383 WideCharToMultiByte(CP_ACP
, 0, mwi
->lpName
, -1, ansi_name
, len
, NULL
, NULL
);
385 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYMEDIA
, (WPARAM
)mwi
->hWnd
, (LPARAM
)ansi_name
);
387 HeapFree(GetProcessHeap(), 0, ansi_name
);
390 SendMessageW(mwi
->hwndOwner
, MCIWNDM_NOTIFYMEDIA
, (WPARAM
)mwi
->hWnd
, (LPARAM
)mwi
->lpName
);
395 static MCIERROR
mci_generic_command(MCIWndInfo
*mwi
, UINT cmd
)
397 MCI_GENERIC_PARMS mci_generic
;
399 mci_generic
.dwCallback
= 0;
400 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, cmd
, 0, (DWORD_PTR
)&mci_generic
);
403 return mwi
->lasterror
;
405 MCIWND_notify_mode(mwi
);
406 MCIWND_UpdateState(mwi
);
410 static LRESULT
mci_get_devcaps(MCIWndInfo
*mwi
, UINT cap
)
412 MCI_GETDEVCAPS_PARMS mci_devcaps
;
414 mci_devcaps
.dwItem
= cap
;
415 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_GETDEVCAPS
,
417 (DWORD_PTR
)&mci_devcaps
);
421 return mci_devcaps
.dwReturn
;
424 static LRESULT
MCIWND_KeyDown(MCIWndInfo
*mwi
, UINT key
)
426 TRACE("%p, key %04x\n", mwi
->hWnd
, key
);
431 SendMessageW(mwi
->hWnd
, MCI_STOP
, 0, 0);
439 static LRESULT WINAPI
MCIWndProc(HWND hWnd
, UINT wMsg
, WPARAM wParam
, LPARAM lParam
)
443 TRACE("%p %04x %08lx %08lx\n", hWnd
, wMsg
, wParam
, lParam
);
445 mwi
= (MCIWndInfo
*)GetWindowLongPtrW(hWnd
, 0);
446 if (!mwi
&& wMsg
!= WM_CREATE
)
447 return DefWindowProcW(hWnd
, wMsg
, wParam
, lParam
);
452 MCIWND_Create(hWnd
, (CREATESTRUCTW
*)lParam
);
457 KillTimer(hWnd
, mwi
->uTimer
);
460 SendMessageW(hWnd
, MCI_CLOSE
, 0, 0);
462 HeapFree(GetProcessHeap(), 0, mwi
);
464 DestroyWindow(GetDlgItem(hWnd
, CTL_MENU
));
465 DestroyWindow(GetDlgItem(hWnd
, CTL_PLAYSTOP
));
466 DestroyWindow(GetDlgItem(hWnd
, CTL_TRACKBAR
));
471 MCI_DGV_UPDATE_PARMS mci_update
;
474 mci_update
.hDC
= (wParam
) ? (HDC
)wParam
: BeginPaint(hWnd
, &ps
);
476 mciSendCommandW(mwi
->mci
, MCI_UPDATE
,
477 MCI_DGV_UPDATE_HDC
| MCI_DGV_UPDATE_PAINT
,
478 (DWORD_PTR
)&mci_update
);
480 if (!wParam
) EndPaint(hWnd
, &ps
);
485 return MCIWND_Command(mwi
, wParam
, lParam
);
488 return MCIWND_KeyDown(mwi
, wParam
);
493 KillTimer(hWnd
, mwi
->uTimer
);
494 mwi
->uTimer
= SetTimer(hWnd
, 1, wParam
? mwi
->active_timer
: mwi
->inactive_timer
, NULL
);
499 MCIWND_UpdateState(mwi
);
503 SetWindowPos(GetDlgItem(hWnd
, CTL_PLAYSTOP
), 0, 0, HIWORD(lParam
) - 32, 0, 0, SWP_NOSIZE
| SWP_NOACTIVATE
);
504 SetWindowPos(GetDlgItem(hWnd
, CTL_MENU
), 0, 32, HIWORD(lParam
) - 32, 0, 0, SWP_NOSIZE
| SWP_NOACTIVATE
);
505 SetWindowPos(GetDlgItem(hWnd
, CTL_TRACKBAR
), 0, 64, HIWORD(lParam
) - 32, LOWORD(lParam
) - 64, 32, SWP_NOACTIVATE
);
507 if (!(mwi
->dwStyle
& MCIWNDF_NOAUTOSIZEMOVIE
))
511 rc
.left
= rc
.top
= 0;
512 rc
.right
= LOWORD(lParam
);
513 rc
.bottom
= HIWORD(lParam
);
514 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
515 rc
.bottom
-= 32; /* subtract the height of the playbar */
516 SendMessageW(hWnd
, MCIWNDM_PUT_DEST
, 0, (LPARAM
)&rc
);
518 MCIWND_notify_size(mwi
);
522 MCIWND_notify_mode(mwi
);
523 MCIWND_UpdateState(mwi
);
528 UNICODE_STRING nameW
;
529 TRACE("MCIWNDM_OPENA %s\n", debugstr_a((LPSTR
)lParam
));
530 RtlCreateUnicodeStringFromAsciiz(&nameW
, (LPCSTR
)lParam
);
531 lParam
= (LPARAM
)nameW
.Buffer
;
538 MCI_OPEN_PARMSW mci_open
;
539 MCI_GETDEVCAPS_PARMS mci_devcaps
;
541 WCHAR drv_name
[MAX_PATH
];
542 static const WCHAR formatW
[] = {'%','d',0};
543 static const WCHAR mci32W
[] = {'m','c','i','3','2',0};
544 static const WCHAR system_iniW
[] = {'s','y','s','t','e','m','.','i','n','i',0};
546 TRACE("MCIWNDM_OPENW %s\n", debugstr_w((LPWSTR
)lParam
));
548 if (wParam
== MCIWNDOPENF_NEW
)
550 SendMessageW(hWnd
, MCIWNDM_NEWW
, 0, lParam
);
551 goto end_of_mci_open
;
556 KillTimer(hWnd
, mwi
->uTimer
);
560 hCursor
= LoadCursorW(0, (LPWSTR
)IDC_WAIT
);
561 hCursor
= SetCursor(hCursor
);
563 mci_open
.lpstrElementName
= (LPWSTR
)lParam
;
564 wsprintfW(aliasW
, formatW
, HandleToLong(hWnd
) + 1);
565 mci_open
.lpstrAlias
= aliasW
;
566 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_OPEN
,
567 MCI_OPEN_ELEMENT
| MCI_OPEN_ALIAS
| MCI_WAIT
,
568 (DWORD_PTR
)&mci_open
);
571 if (mwi
->lasterror
&& !(mwi
->dwStyle
& MCIWNDF_NOERRORDLG
))
573 /* FIXME: get the caption from resources */
574 static const WCHAR caption
[] = {'M','C','I',' ','E','r','r','o','r',0};
575 WCHAR error_str
[MAXERRORLENGTH
];
577 mciGetErrorStringW(mwi
->lasterror
, error_str
, MAXERRORLENGTH
);
578 MessageBoxW(hWnd
, error_str
, caption
, MB_ICONEXCLAMATION
| MB_OK
);
579 MCIWND_notify_error(mwi
);
580 goto end_of_mci_open
;
583 mwi
->mci
= mci_open
.wDeviceID
;
584 mwi
->alias
= HandleToLong(hWnd
) + 1;
586 mwi
->lpName
= HeapAlloc(GetProcessHeap(), 0, (strlenW((LPWSTR
)lParam
) + 1) * sizeof(WCHAR
));
587 strcpyW(mwi
->lpName
, (LPWSTR
)lParam
);
589 MCIWND_UpdateState(mwi
);
591 mci_devcaps
.dwItem
= MCI_GETDEVCAPS_DEVICE_TYPE
;
592 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_GETDEVCAPS
,
594 (DWORD_PTR
)&mci_devcaps
);
597 MCIWND_notify_error(mwi
);
598 goto end_of_mci_open
;
601 mwi
->dev_type
= mci_devcaps
.dwReturn
;
604 SendMessageW(hWnd
, MCIWNDM_GETDEVICEW
, 256, (LPARAM
)drv_name
);
605 if (drv_name
[0] && GetPrivateProfileStringW(mci32W
, drv_name
, NULL
,
606 drv_name
, MAX_PATH
, system_iniW
))
607 mwi
->hdrv
= OpenDriver(drv_name
, NULL
, 0);
609 if (mwi
->dev_type
== MCI_DEVTYPE_DIGITAL_VIDEO
)
611 MCI_DGV_WINDOW_PARMSW mci_window
;
613 mci_window
.hWnd
= hWnd
;
614 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_WINDOW
,
616 (DWORD_PTR
)&mci_window
);
619 MCIWND_notify_error(mwi
);
620 goto end_of_mci_open
;
624 if (SendMessageW(hWnd
, MCIWNDM_GET_DEST
, 0, (LPARAM
)&rc
) == 0)
626 mwi
->size
.cx
= rc
.right
- rc
.left
;
627 mwi
->size
.cy
= rc
.bottom
- rc
.top
;
629 rc
.right
= MulDiv(mwi
->size
.cx
, mwi
->zoom
, 100);
630 rc
.bottom
= MulDiv(mwi
->size
.cy
, mwi
->zoom
, 100);
631 SendMessageW(hWnd
, MCIWNDM_PUT_DEST
, 0, (LPARAM
)&rc
);
635 GetClientRect(hWnd
, &rc
);
639 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
640 rc
.bottom
+= 32; /* add the height of the playbar */
641 AdjustWindowRect(&rc
, GetWindowLongW(hWnd
, GWL_STYLE
), FALSE
);
642 SetWindowPos(hWnd
, 0, 0, 0, rc
.right
- rc
.left
,
643 rc
.bottom
- rc
.top
, SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
645 SendDlgItemMessageW(hWnd
, CTL_TRACKBAR
, TBM_SETRANGEMIN
, 0L, 0L);
646 SendDlgItemMessageW(hWnd
, CTL_TRACKBAR
, TBM_SETRANGEMAX
, 1,
647 SendMessageW(hWnd
, MCIWNDM_GETLENGTH
, 0, 0));
648 mwi
->uTimer
= SetTimer(hWnd
, 1, mwi
->active_timer
, NULL
);
650 MCIWND_notify_media(mwi
);
653 if (wMsg
== MCIWNDM_OPENA
)
654 HeapFree(GetProcessHeap(), 0, (void *)lParam
);
655 return mwi
->lasterror
;
658 case MCIWNDM_GETDEVICEID
:
659 TRACE("MCIWNDM_GETDEVICEID\n");
662 case MCIWNDM_GETALIAS
:
663 TRACE("MCIWNDM_GETALIAS\n");
666 case MCIWNDM_GET_SOURCE
:
668 MCI_DGV_RECT_PARMS mci_rect
;
670 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_WHERE
,
671 MCI_DGV_WHERE_SOURCE
,
672 (DWORD_PTR
)&mci_rect
);
675 MCIWND_notify_error(mwi
);
676 return mwi
->lasterror
;
678 *(RECT
*)lParam
= mci_rect
.rc
;
679 TRACE("MCIWNDM_GET_SOURCE: %s\n", wine_dbgstr_rect(&mci_rect
.rc
));
683 case MCIWNDM_GET_DEST
:
685 MCI_DGV_RECT_PARMS mci_rect
;
687 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_WHERE
,
688 MCI_DGV_WHERE_DESTINATION
,
689 (DWORD_PTR
)&mci_rect
);
692 MCIWND_notify_error(mwi
);
693 return mwi
->lasterror
;
695 *(RECT
*)lParam
= mci_rect
.rc
;
696 TRACE("MCIWNDM_GET_DEST: %s\n", wine_dbgstr_rect(&mci_rect
.rc
));
700 case MCIWNDM_PUT_SOURCE
:
702 MCI_DGV_PUT_PARMS mci_put
;
704 mci_put
.rc
= *(RECT
*)lParam
;
705 TRACE("MCIWNDM_PUT_SOURCE: %s\n", wine_dbgstr_rect(&mci_put
.rc
));
706 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PUT
,
708 (DWORD_PTR
)&mci_put
);
711 MCIWND_notify_error(mwi
);
712 return mwi
->lasterror
;
717 case MCIWNDM_PUT_DEST
:
719 MCI_DGV_PUT_PARMS mci_put
;
721 mci_put
.rc
= *(RECT
*)lParam
;
722 TRACE("MCIWNDM_PUT_DEST: %s\n", wine_dbgstr_rect(&mci_put
.rc
));
724 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PUT
,
725 MCI_DGV_PUT_DESTINATION
| MCI_DGV_RECT
,
726 (DWORD_PTR
)&mci_put
);
729 MCIWND_notify_error(mwi
);
730 return mwi
->lasterror
;
735 case MCIWNDM_GETLENGTH
:
737 MCI_STATUS_PARMS mci_status
;
739 mci_status
.dwItem
= MCI_STATUS_LENGTH
;
740 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
742 (DWORD_PTR
)&mci_status
);
745 MCIWND_notify_error(mwi
);
748 TRACE("MCIWNDM_GETLENGTH: %ld\n", mci_status
.dwReturn
);
749 return mci_status
.dwReturn
;
752 case MCIWNDM_GETSTART
:
754 MCI_STATUS_PARMS mci_status
;
756 mci_status
.dwItem
= MCI_STATUS_POSITION
;
757 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
758 MCI_STATUS_ITEM
| MCI_STATUS_START
,
759 (DWORD_PTR
)&mci_status
);
762 MCIWND_notify_error(mwi
);
765 TRACE("MCIWNDM_GETSTART: %ld\n", mci_status
.dwReturn
);
766 return mci_status
.dwReturn
;
771 LRESULT start
, length
;
773 start
= SendMessageW(hWnd
, MCIWNDM_GETSTART
, 0, 0);
774 length
= SendMessageW(hWnd
, MCIWNDM_GETLENGTH
, 0, 0);
775 TRACE("MCIWNDM_GETEND: %ld\n", start
+ length
);
776 return (start
+ length
);
779 case MCIWNDM_GETPOSITIONA
:
780 case MCIWNDM_GETPOSITIONW
:
782 MCI_STATUS_PARMS mci_status
;
784 TRACE("MCIWNDM_GETPOSITION\n");
786 /* get position string if requested */
787 if (wParam
&& lParam
)
789 if (wMsg
== MCIWNDM_GETPOSITIONA
)
793 wsprintfA(cmd
, "status %d position", mwi
->alias
);
794 mwi
->lasterror
= mciSendStringA(cmd
, (LPSTR
)lParam
, wParam
, 0);
800 static const WCHAR formatW
[] = {'s','t','a','t','u','s',' ','%','d',' ','p','o','s','i','t','i','o','n',0};
802 wsprintfW(cmdW
, formatW
, mwi
->alias
);
803 mwi
->lasterror
= mciSendStringW(cmdW
, (LPWSTR
)lParam
, wParam
, 0);
810 mci_status
.dwItem
= MCI_STATUS_POSITION
;
811 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
813 (DWORD_PTR
)&mci_status
);
817 return mci_status
.dwReturn
;
820 case MCIWNDM_GETMODEA
:
821 case MCIWNDM_GETMODEW
:
823 MCI_STATUS_PARMS mci_status
;
825 TRACE("MCIWNDM_GETMODE\n");
828 return MCI_MODE_NOT_READY
;
830 /* get mode string if requested */
831 if (wParam
&& lParam
)
833 if (wMsg
== MCIWNDM_GETMODEA
)
837 wsprintfA(cmd
, "status %d mode", mwi
->alias
);
838 mwi
->lasterror
= mciSendStringA(cmd
, (LPSTR
)lParam
, wParam
, 0);
844 static const WCHAR formatW
[] = {'s','t','a','t','u','s',' ','%','d',' ','m','o','d','e',0};
846 wsprintfW(cmdW
, formatW
, mwi
->alias
);
847 mwi
->lasterror
= mciSendStringW(cmdW
, (LPWSTR
)lParam
, wParam
, 0);
851 return MCI_MODE_NOT_READY
;
854 mci_status
.dwItem
= MCI_STATUS_MODE
;
855 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
857 (DWORD_PTR
)&mci_status
);
859 return MCI_MODE_NOT_READY
;
861 return mci_status
.dwReturn
;
864 case MCIWNDM_PLAYFROM
:
866 MCI_PLAY_PARMS mci_play
;
868 TRACE("MCIWNDM_PLAYFROM %08lx\n", lParam
);
870 mci_play
.dwCallback
= (DWORD_PTR
)hWnd
;
871 mci_play
.dwFrom
= lParam
;
872 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PLAY
,
873 MCI_FROM
| MCI_NOTIFY
,
874 (DWORD_PTR
)&mci_play
);
877 MCIWND_notify_error(mwi
);
878 return mwi
->lasterror
;
881 MCIWND_notify_mode(mwi
);
882 MCIWND_UpdateState(mwi
);
888 MCI_PLAY_PARMS mci_play
;
890 TRACE("MCIWNDM_PLAYTO %08lx\n", lParam
);
892 mci_play
.dwCallback
= (DWORD_PTR
)hWnd
;
893 mci_play
.dwTo
= lParam
;
894 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PLAY
,
896 (DWORD_PTR
)&mci_play
);
899 MCIWND_notify_error(mwi
);
900 return mwi
->lasterror
;
903 MCIWND_notify_mode(mwi
);
904 MCIWND_UpdateState(mwi
);
908 case MCIWNDM_PLAYREVERSE
:
910 MCI_PLAY_PARMS mci_play
;
911 DWORD flags
= MCI_NOTIFY
;
913 TRACE("MCIWNDM_PLAYREVERSE %08lx\n", lParam
);
915 mci_play
.dwCallback
= (DWORD_PTR
)hWnd
;
916 mci_play
.dwFrom
= lParam
;
917 switch (mwi
->dev_type
)
920 case MCI_DEVTYPE_ANIMATION
:
921 flags
|= MCI_ANIM_PLAY_REVERSE
;
924 case MCI_DEVTYPE_DIGITAL_VIDEO
:
925 flags
|= MCI_DGV_PLAY_REVERSE
;
928 #ifdef MCI_VCR_PLAY_REVERSE
929 case MCI_DEVTYPE_VCR
:
930 flags
|= MCI_VCR_PLAY_REVERSE
;
934 case MCI_DEVTYPE_VIDEODISC
:
935 flags
|= MCI_VD_PLAY_REVERSE
;
939 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_PLAY
,
940 flags
, (DWORD_PTR
)&mci_play
);
943 MCIWND_notify_error(mwi
);
944 return mwi
->lasterror
;
947 MCIWND_notify_mode(mwi
);
948 MCIWND_UpdateState(mwi
);
952 case MCIWNDM_GETERRORA
:
953 mciGetErrorStringA(mwi
->lasterror
, (LPSTR
)lParam
, wParam
);
954 TRACE("MCIWNDM_GETERRORA: %s\n", debugstr_an((LPSTR
)lParam
, wParam
));
955 return mwi
->lasterror
;
957 case MCIWNDM_GETERRORW
:
958 mciGetErrorStringW(mwi
->lasterror
, (LPWSTR
)lParam
, wParam
);
959 TRACE("MCIWNDM_GETERRORW: %s\n", debugstr_wn((LPWSTR
)lParam
, wParam
));
960 return mwi
->lasterror
;
962 case MCIWNDM_SETOWNER
:
963 TRACE("MCIWNDM_SETOWNER %p\n", (HWND
)wParam
);
964 mwi
->hwndOwner
= (HWND
)wParam
;
967 case MCIWNDM_SENDSTRINGA
:
969 UNICODE_STRING stringW
;
971 TRACE("MCIWNDM_SENDSTRINGA %s\n", debugstr_a((LPCSTR
)lParam
));
973 RtlCreateUnicodeStringFromAsciiz(&stringW
, (LPCSTR
)lParam
);
974 lParam
= (LPARAM
)stringW
.Buffer
;
977 case MCIWNDM_SENDSTRINGW
:
981 TRACE("MCIWNDM_SENDSTRINGW %s\n", debugstr_w((LPCWSTR
)lParam
));
983 p
= strchrW((LPCWSTR
)lParam
, ' ');
986 static const WCHAR formatW
[] = {'%','d',' ',0};
989 pos
= p
- (WCHAR
*)lParam
+ 1;
990 len
= lstrlenW((LPCWSTR
)lParam
) + 64;
992 cmdW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
994 memcpy(cmdW
, (void *)lParam
, pos
* sizeof(WCHAR
));
995 wsprintfW(cmdW
+ pos
, formatW
, mwi
->alias
);
996 strcatW(cmdW
, (WCHAR
*)lParam
+ pos
);
999 cmdW
= (LPWSTR
)lParam
;
1001 mwi
->lasterror
= mciSendStringW(cmdW
, mwi
->return_string
,
1002 sizeof(mwi
->return_string
)/sizeof(mwi
->return_string
[0]),
1005 MCIWND_notify_error(mwi
);
1007 if (cmdW
!= (LPWSTR
)lParam
)
1008 HeapFree(GetProcessHeap(), 0, cmdW
);
1010 if (wMsg
== MCIWNDM_SENDSTRINGA
)
1011 HeapFree(GetProcessHeap(), 0, (void *)lParam
);
1013 MCIWND_UpdateState(mwi
);
1014 return mwi
->lasterror
;
1017 case MCIWNDM_RETURNSTRINGA
:
1018 WideCharToMultiByte(CP_ACP
, 0, mwi
->return_string
, -1, (LPSTR
)lParam
, wParam
, NULL
, NULL
);
1019 TRACE("MCIWNDM_RETURNTRINGA %s\n", debugstr_an((LPSTR
)lParam
, wParam
));
1020 return mwi
->lasterror
;
1022 case MCIWNDM_RETURNSTRINGW
:
1023 lstrcpynW((LPWSTR
)lParam
, mwi
->return_string
, wParam
);
1024 TRACE("MCIWNDM_RETURNTRINGW %s\n", debugstr_wn((LPWSTR
)lParam
, wParam
));
1025 return mwi
->lasterror
;
1027 case MCIWNDM_SETTIMERS
:
1028 TRACE("MCIWNDM_SETTIMERS active %d ms, inactive %d ms\n", (int)wParam
, (int)lParam
);
1029 mwi
->active_timer
= (WORD
)wParam
;
1030 mwi
->inactive_timer
= (WORD
)lParam
;
1033 case MCIWNDM_SETACTIVETIMER
:
1034 TRACE("MCIWNDM_SETACTIVETIMER %d ms\n", (int)wParam
);
1035 mwi
->active_timer
= (WORD
)wParam
;
1038 case MCIWNDM_SETINACTIVETIMER
:
1039 TRACE("MCIWNDM_SETINACTIVETIMER %d ms\n", (int)wParam
);
1040 mwi
->inactive_timer
= (WORD
)wParam
;
1043 case MCIWNDM_GETACTIVETIMER
:
1044 TRACE("MCIWNDM_GETACTIVETIMER: %d ms\n", mwi
->active_timer
);
1045 return mwi
->active_timer
;
1047 case MCIWNDM_GETINACTIVETIMER
:
1048 TRACE("MCIWNDM_GETINACTIVETIMER: %d ms\n", mwi
->inactive_timer
);
1049 return mwi
->inactive_timer
;
1051 case MCIWNDM_CHANGESTYLES
:
1052 TRACE("MCIWNDM_CHANGESTYLES mask %08lx, set %08lx\n", wParam
, lParam
);
1053 /* FIXME: update the visual window state as well:
1054 * add/remove trackbar, autosize, etc.
1056 mwi
->dwStyle
&= ~wParam
;
1057 mwi
->dwStyle
|= lParam
& wParam
;
1060 case MCIWNDM_GETSTYLES
:
1061 TRACE("MCIWNDM_GETSTYLES: %08x\n", mwi
->dwStyle
& 0xffff);
1062 return mwi
->dwStyle
& 0xffff;
1064 case MCIWNDM_GETDEVICEA
:
1066 MCI_SYSINFO_PARMSA mci_sysinfo
;
1068 mci_sysinfo
.lpstrReturn
= (LPSTR
)lParam
;
1069 mci_sysinfo
.dwRetSize
= wParam
;
1070 mwi
->lasterror
= mciSendCommandA(mwi
->mci
, MCI_SYSINFO
,
1071 MCI_SYSINFO_INSTALLNAME
,
1072 (DWORD_PTR
)&mci_sysinfo
);
1073 TRACE("MCIWNDM_GETDEVICEA: %s\n", debugstr_an((LPSTR
)lParam
, wParam
));
1077 case MCIWNDM_GETDEVICEW
:
1079 MCI_SYSINFO_PARMSW mci_sysinfo
;
1081 mci_sysinfo
.lpstrReturn
= (LPWSTR
)lParam
;
1082 mci_sysinfo
.dwRetSize
= wParam
;
1083 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_SYSINFO
,
1084 MCI_SYSINFO_INSTALLNAME
,
1085 (DWORD_PTR
)&mci_sysinfo
);
1086 TRACE("MCIWNDM_GETDEVICEW: %s\n", debugstr_wn((LPWSTR
)lParam
, wParam
));
1090 case MCIWNDM_VALIDATEMEDIA
:
1091 TRACE("MCIWNDM_VALIDATEMEDIA\n");
1094 SendMessageW(hWnd
, MCIWNDM_GETSTART
, 0, 0);
1095 SendMessageW(hWnd
, MCIWNDM_GETLENGTH
, 0, 0);
1099 case MCIWNDM_GETFILENAMEA
:
1100 TRACE("MCIWNDM_GETFILENAMEA: %s\n", debugstr_w(mwi
->lpName
));
1102 WideCharToMultiByte(CP_ACP
, 0, mwi
->lpName
, -1, (LPSTR
)lParam
, wParam
, NULL
, NULL
);
1105 case MCIWNDM_GETFILENAMEW
:
1106 TRACE("MCIWNDM_GETFILENAMEW: %s\n", debugstr_w(mwi
->lpName
));
1108 lstrcpynW((LPWSTR
)lParam
, mwi
->lpName
, wParam
);
1111 case MCIWNDM_GETTIMEFORMATA
:
1112 case MCIWNDM_GETTIMEFORMATW
:
1114 MCI_STATUS_PARMS mci_status
;
1116 TRACE("MCIWNDM_GETTIMEFORMAT %08lx %08lx\n", wParam
, lParam
);
1118 /* get format string if requested */
1119 if (wParam
&& lParam
)
1121 if (wMsg
== MCIWNDM_GETTIMEFORMATA
)
1125 wsprintfA(cmd
, "status %d time format", mwi
->alias
);
1126 mwi
->lasterror
= mciSendStringA(cmd
, (LPSTR
)lParam
, wParam
, 0);
1133 static const WCHAR formatW
[] = {'s','t','a','t','u','s',' ','%','d',' ','t','i','m','e',' ','f','o','r','m','a','t',0};
1135 wsprintfW(cmdW
, formatW
, mwi
->alias
);
1136 mwi
->lasterror
= mciSendStringW(cmdW
, (LPWSTR
)lParam
, wParam
, 0);
1142 mci_status
.dwItem
= MCI_STATUS_TIME_FORMAT
;
1143 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_STATUS
,
1145 (DWORD_PTR
)&mci_status
);
1149 return mci_status
.dwReturn
;
1152 case MCIWNDM_SETTIMEFORMATA
:
1154 UNICODE_STRING stringW
;
1156 TRACE("MCIWNDM_SETTIMEFORMATA %s\n", debugstr_a((LPSTR
)lParam
));
1158 RtlCreateUnicodeStringFromAsciiz(&stringW
, (LPCSTR
)lParam
);
1159 lParam
= (LPARAM
)stringW
.Buffer
;
1162 case MCIWNDM_SETTIMEFORMATW
:
1164 static const WCHAR formatW
[] = {'s','e','t',' ','%','d',' ','t','i','m','e',' ','f','o','r','m','a','t',' ',0};
1167 TRACE("MCIWNDM_SETTIMEFORMATW %s\n", debugstr_w((LPWSTR
)lParam
));
1171 cmdW
= HeapAlloc(GetProcessHeap(), 0, (lstrlenW((LPCWSTR
)lParam
) + 64) * sizeof(WCHAR
));
1172 wsprintfW(cmdW
, formatW
, mwi
->alias
);
1173 strcatW(cmdW
, (WCHAR
*)lParam
);
1175 mwi
->lasterror
= mciSendStringW(cmdW
, NULL
, 0, 0);
1177 /* fix the range tracking according to the new time format */
1178 if (!mwi
->lasterror
)
1179 SendDlgItemMessageW(hWnd
, CTL_TRACKBAR
, TBM_SETRANGEMAX
, 1,
1180 SendMessageW(hWnd
, MCIWNDM_GETLENGTH
, 0, 0));
1182 HeapFree(GetProcessHeap(), 0, cmdW
);
1185 if (wMsg
== MCIWNDM_SETTIMEFORMATA
)
1186 HeapFree(GetProcessHeap(), 0, (void *)lParam
);
1191 case MCIWNDM_CAN_PLAY
:
1192 TRACE("MCIWNDM_CAN_PLAY\n");
1194 return mci_get_devcaps(mwi
, MCI_GETDEVCAPS_CAN_PLAY
);
1197 case MCIWNDM_CAN_RECORD
:
1198 TRACE("MCIWNDM_CAN_RECORD\n");
1200 return mci_get_devcaps(mwi
, MCI_GETDEVCAPS_CAN_RECORD
);
1203 case MCIWNDM_CAN_SAVE
:
1204 TRACE("MCIWNDM_CAN_SAVE\n");
1206 return mci_get_devcaps(mwi
, MCI_GETDEVCAPS_CAN_SAVE
);
1209 case MCIWNDM_CAN_EJECT
:
1210 TRACE("MCIWNDM_CAN_EJECT\n");
1212 return mci_get_devcaps(mwi
, MCI_GETDEVCAPS_CAN_EJECT
);
1215 case MCIWNDM_CAN_WINDOW
:
1216 TRACE("MCIWNDM_CAN_WINDOW\n");
1217 switch (mwi
->dev_type
)
1219 case MCI_DEVTYPE_ANIMATION
:
1220 case MCI_DEVTYPE_DIGITAL_VIDEO
:
1221 case MCI_DEVTYPE_OVERLAY
:
1226 case MCIWNDM_CAN_CONFIG
:
1227 TRACE("MCIWNDM_CAN_CONFIG\n");
1229 return SendDriverMessage(mwi
->hdrv
, DRV_QUERYCONFIGURE
, 0, 0);
1232 case MCIWNDM_SETZOOM
:
1233 TRACE("MCIWNDM_SETZOOM %ld\n", lParam
);
1236 if (mwi
->mci
&& !(mwi
->dwStyle
& MCIWNDF_NOAUTOSIZEWINDOW
))
1240 rc
.left
= rc
.top
= 0;
1241 rc
.right
= MulDiv(mwi
->size
.cx
, mwi
->zoom
, 100);
1242 rc
.bottom
= MulDiv(mwi
->size
.cy
, mwi
->zoom
, 100);
1244 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
1245 rc
.bottom
+= 32; /* add the height of the playbar */
1246 AdjustWindowRect(&rc
, GetWindowLongW(hWnd
, GWL_STYLE
), FALSE
);
1247 SetWindowPos(hWnd
, 0, 0, 0, rc
.right
- rc
.left
, rc
.bottom
- rc
.top
,
1248 SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
1252 case MCIWNDM_GETZOOM
:
1253 TRACE("MCIWNDM_GETZOOM: %d\n", mwi
->zoom
);
1258 MCI_SET_PARMS mci_set
;
1260 TRACE("MCIWNDM_EJECT\n");
1262 mci_set
.dwCallback
= (DWORD_PTR
)hWnd
;
1263 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_SET
,
1264 MCI_SET_DOOR_OPEN
| MCI_NOTIFY
,
1265 (DWORD_PTR
)&mci_set
);
1266 MCIWND_notify_mode(mwi
);
1267 MCIWND_UpdateState(mwi
);
1268 return mwi
->lasterror
;
1271 case MCIWNDM_SETVOLUME
:
1272 case MCIWNDM_GETVOLUME
:
1273 case MCIWNDM_SETSPEED
:
1274 case MCIWNDM_GETSPEED
:
1275 case MCIWNDM_SETREPEAT
:
1276 case MCIWNDM_GETREPEAT
:
1277 case MCIWNDM_REALIZE
:
1278 case MCIWNDM_GETPALETTE
:
1279 case MCIWNDM_SETPALETTE
:
1282 case MCIWNDM_PALETTEKICK
:
1283 case MCIWNDM_OPENINTERFACE
:
1284 FIXME("support for MCIWNDM_ message WM_USER+%d not implemented\n", wMsg
- WM_USER
);
1289 LRESULT end
= SendMessageW(hWnd
, MCIWNDM_GETEND
, 0, 0);
1290 return SendMessageW(hWnd
, MCIWNDM_PLAYTO
, 0, end
);
1296 MCI_SEEK_PARMS mci_seek
; /* Layout is usable as MCI_XYZ_STEP_PARMS */
1297 DWORD flags
= MCI_STEP
== wMsg
? 0 :
1298 MCIWND_START
== lParam
? MCI_SEEK_TO_START
:
1299 MCIWND_END
== lParam
? MCI_SEEK_TO_END
: MCI_TO
;
1301 mci_seek
.dwTo
= lParam
;
1302 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, wMsg
,
1303 flags
, (DWORD_PTR
)&mci_seek
);
1306 MCIWND_notify_error(mwi
);
1307 return mwi
->lasterror
;
1309 /* update window to reflect the state */
1310 else InvalidateRect(hWnd
, NULL
, TRUE
);
1317 MCI_GENERIC_PARMS mci_generic
;
1321 CloseDriver(mwi
->hdrv
, 0, 0);
1327 mci_generic
.dwCallback
= 0;
1328 mwi
->lasterror
= mciSendCommandW(mwi
->mci
, MCI_CLOSE
,
1329 0, (DWORD_PTR
)&mci_generic
);
1333 mwi
->mode
= MCI_MODE_NOT_READY
;
1336 HeapFree(GetProcessHeap(), 0, mwi
->lpName
);
1338 MCIWND_UpdateState(mwi
);
1340 GetClientRect(hWnd
, &rc
);
1342 if (!(mwi
->dwStyle
& MCIWNDF_NOPLAYBAR
))
1343 rc
.bottom
+= 32; /* add the height of the playbar */
1344 AdjustWindowRect(&rc
, GetWindowLongW(hWnd
, GWL_STYLE
), FALSE
);
1345 SetWindowPos(hWnd
, 0, 0, 0, rc
.right
- rc
.left
,
1346 rc
.bottom
- rc
.top
, SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
1348 MCIWND_notify_media(mwi
);
1355 mci_generic_command(mwi
, wMsg
);
1356 return mwi
->lasterror
;
1360 SendDriverMessage(mwi
->hdrv
, DRV_CONFIGURE
, (LPARAM
)hWnd
, 0);
1371 case MCI_GETDEVCAPS
:
1389 /*case MCI_SETTIMECODE:*/
1390 /*case MCI_SETTUNER:*/
1401 FIXME("support for MCI_ command %04x not implemented\n", wMsg
);
1405 if (wMsg
>= WM_USER
)
1407 FIXME("support for MCIWNDM_ message WM_USER+%d not implemented\n", wMsg
- WM_USER
);
1411 if (GetWindowLongW(hWnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
1412 return DefMDIChildProcW(hWnd
, wMsg
, wParam
, lParam
);
1414 return DefWindowProcW(hWnd
, wMsg
, wParam
, lParam
);