ReactOS 0.4.15-dev-8235-gcd88a97
wnd.c File Reference
#include <string.h>
#include "private_mciavi.h"
#include "wine/debug.h"
Include dependency graph for wnd.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (mciavi)
 
static LRESULT WINAPI MCIAVI_WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL MCIAVI_UnregisterClass (void)
 
BOOL MCIAVI_RegisterClass (void)
 
BOOL MCIAVI_CreateWindow (WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpParms)
 
DWORD MCIAVI_mciPut (UINT wDevID, DWORD dwFlags, LPMCI_DGV_PUT_PARMS lpParms)
 
DWORD MCIAVI_mciWhere (UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
 
DWORD MCIAVI_mciWindow (UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSW lpParms)
 

Variables

static const WCHAR mciaviW [] = {'M','C','I','A','V','I',0}
 

Function Documentation

◆ MCIAVI_CreateWindow()

BOOL MCIAVI_CreateWindow ( WINE_MCIAVI wma,
DWORD  dwFlags,
LPMCI_DGV_OPEN_PARMSW  lpParms 
)

Definition at line 112 of file wnd.c.

113{
114 static const WCHAR captionW[] = {'W','i','n','e',' ','M','C','I','-','A','V','I',' ','p','l','a','y','e','r',0};
115 HWND hParent = 0;
116 DWORD dwStyle = WS_OVERLAPPEDWINDOW;
117 RECT rc;
118
119 /* what should be done ? */
120 if (wma->hWnd) return TRUE;
121
122 if (dwFlags & MCI_DGV_OPEN_PARENT) hParent = lpParms->hWndParent;
123 if (dwFlags & MCI_DGV_OPEN_WS) dwStyle = lpParms->dwStyle;
124
125 if (wma->hic)
126 SetRect(&rc, 0, 0, wma->outbih->biWidth, wma->outbih->biHeight);
127 else
128 SetRect(&rc, 0, 0, wma->inbih->biWidth, wma->inbih->biHeight);
129
130 AdjustWindowRect(&rc, dwStyle, FALSE);
131 if (!(dwStyle & (WS_CHILD|WS_POPUP))) /* overlapped window ? */
132 {
133 rc.right -= rc.left;
134 rc.bottom -= rc.top;
135 rc.left = rc.top = CW_USEDEFAULT;
136 }
137
138 wma->hWnd = CreateWindowW(mciaviW, captionW,
139 dwStyle, rc.left, rc.top,
140 rc.right, rc.bottom,
141 hParent, 0, MCIAVI_hInstance,
142 ULongToPtr(wma->wDevID));
143 wma->hWndPaint = wma->hWnd;
144
145 TRACE("(%04x, %08X, %p, style %x, parent %p, dimensions %dx%d, hwnd %p)\n", wma->wDevID,
146 dwFlags, lpParms, dwStyle, hParent, rc.right - rc.left, rc.bottom - rc.top, wma->hWnd);
147 return wma->hWnd != 0;
148}
#define ULongToPtr(ul)
Definition: basetsd.h:92
#define MCI_DGV_OPEN_PARENT
Definition: digitalv.h:212
#define MCI_DGV_OPEN_WS
Definition: digitalv.h:211
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
HINSTANCE MCIAVI_hInstance
Definition: mciavi.c:52
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_POPUP
Definition: pedump.c:616
#define TRACE(s)
Definition: solgame.cpp:4
MCIDEVICEID wDevID
LPBITMAPINFOHEADER inbih
LPBITMAPINFOHEADER outbih
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4316
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
static const WCHAR mciaviW[]
Definition: wnd.c:28
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by MCIAVI_mciOpen().

◆ MCIAVI_mciPut()

DWORD MCIAVI_mciPut ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_PUT_PARMS  lpParms 
)

Definition at line 153 of file wnd.c.

154{
155 WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
156 RECT rc;
157
158 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
159
160 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
161 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
162 if (dwFlags & MCI_TEST) return 0;
163
165
166 if (dwFlags & MCI_DGV_RECT) {
167 /* In MCI, RECT structure is used differently: rc.right = width & rc.bottom = height
168 * So convert input MCI RECT into a normal RECT */
169 SetRect(&rc, lpParms->rc.left, lpParms->rc.top, lpParms->rc.left + lpParms->rc.right,
170 lpParms->rc.top + lpParms->rc.bottom);
171 } else {
172 GetClientRect(wma->hWndPaint, &rc);
173 }
174
176 FIXME("PUT_CLIENT %s\n", wine_dbgstr_rect(&rc));
179 }
181 TRACE("PUT_DESTINATION %s\n", wine_dbgstr_rect(&rc));
182 wma->dest = rc;
183 }
185 FIXME("PUT_FRAME %s\n", wine_dbgstr_rect(&rc));
188 }
190 TRACE("PUT_SOURCE %s\n", wine_dbgstr_rect(&rc));
191 wma->source = rc;
192 }
194 FIXME("PUT_VIDEO %s\n", wine_dbgstr_rect(&rc));
197 }
199 TRACE("PUT_WINDOW %s\n", wine_dbgstr_rect(&rc));
200 SetWindowPos(wma->hWndPaint, NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER);
201 }
203 return 0;
204}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define FIXME(fmt,...)
Definition: debug.h:114
#define MCI_DGV_PUT_DESTINATION
Definition: digitalv.h:234
#define MCI_DGV_PUT_SOURCE
Definition: digitalv.h:233
#define MCI_DGV_PUT_WINDOW
Definition: digitalv.h:237
#define MCI_DGV_RECT
Definition: digitalv.h:232
#define MCI_DGV_PUT_CLIENT
Definition: digitalv.h:238
#define MCI_DGV_PUT_VIDEO
Definition: digitalv.h:236
#define MCI_DGV_PUT_FRAME
Definition: digitalv.h:235
#define MCI_TEST
Definition: digitalv.h:32
#define NULL
Definition: types.h:112
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define MCIERR_UNRECOGNIZED_COMMAND
Definition: mmsystem.h:571
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605
CRITICAL_SECTION cs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SWP_NOZORDER
Definition: winuser.h:1247

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciWhere()

DWORD MCIAVI_mciWhere ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_RECT_PARMS  lpParms 
)

Definition at line 209 of file wnd.c.

210{
211 WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
212 RECT rc;
213
214 TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms);
215
216 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
217 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
218 /* Ignore MCI_TEST flag. */
219
221
224 GetClientRect(wma->hWndPaint, &rc);
225 TRACE("WHERE_DESTINATION_MAX %s\n", wine_dbgstr_rect(&rc));
226 } else {
227 TRACE("WHERE_DESTINATION %s\n", wine_dbgstr_rect(&wma->dest));
228 rc = wma->dest;
229 }
230 }
233 FIXME("MCI_DGV_WHERE_FRAME_MAX\n");
234 else
235 FIXME("MCI_DGV_WHERE_FRAME\n");
238 }
241 SetRect(&rc, 0, 0, wma->inbih->biWidth, wma->inbih->biHeight);
242 TRACE("WHERE_SOURCE_MAX %s\n", wine_dbgstr_rect(&rc));
243 } else {
244 TRACE("WHERE_SOURCE %s\n", wine_dbgstr_rect(&wma->source));
245 rc = wma->source;
246 }
247 }
250 FIXME("WHERE_VIDEO_MAX\n");
251 else
252 FIXME("WHERE_VIDEO\n");
255 }
259 TRACE("WHERE_WINDOW_MAX %s\n", wine_dbgstr_rect(&rc));
260 } else {
261 GetWindowRect(wma->hWndPaint, &rc);
262 TRACE("WHERE_WINDOW %s\n", wine_dbgstr_rect(&rc));
263 }
264 }
265
266 /* In MCI, RECT structure is used differently: rc.right = width & rc.bottom = height
267 * So convert the normal RECT into a MCI RECT before returning */
268 SetRect(&lpParms->rc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
269
271 return 0;
272}
#define MCI_DGV_WHERE_WINDOW
Definition: digitalv.h:448
#define MCI_DGV_WHERE_FRAME
Definition: digitalv.h:446
#define MCI_DGV_WHERE_VIDEO
Definition: digitalv.h:447
#define MCI_DGV_WHERE_SOURCE
Definition: digitalv.h:444
#define MCI_DGV_WHERE_MAX
Definition: digitalv.h:449
#define MCI_DGV_WHERE_DESTINATION
Definition: digitalv.h:445
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciWindow()

DWORD MCIAVI_mciWindow ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_WINDOW_PARMSW  lpParms 
)

Definition at line 277 of file wnd.c.

278{
279 WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
280
281 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
282
283 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
284 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
285 if (dwFlags & MCI_TEST) return 0;
286
288
290 if (IsWindow(lpParms->hWnd))
291 {
292 TRACE("Setting hWnd to %p\n", lpParms->hWnd);
293 if (wma->hWnd) ShowWindow(wma->hWnd, SW_HIDE);
294 wma->hWndPaint = (lpParms->hWnd == MCI_DGV_WINDOW_DEFAULT) ? wma->hWnd : lpParms->hWnd;
295 }
296 }
298 TRACE("Setting nCmdShow to %d\n", lpParms->nCmdShow);
299 ShowWindow(wma->hWndPaint, lpParms->nCmdShow);
300 }
302 TRACE("Setting caption to %s\n", debugstr_w(lpParms->lpstrText));
303 SetWindowTextW(wma->hWndPaint, lpParms->lpstrText);
304 }
305
307 return 0;
308}
#define MCI_DGV_WINDOW_STATE
Definition: digitalv.h:454
#define MCI_DGV_WINDOW_DEFAULT
Definition: digitalv.h:459
#define MCI_DGV_WINDOW_TEXT
Definition: digitalv.h:455
#define MCI_DGV_WINDOW_HWND
Definition: digitalv.h:453
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_RegisterClass()

BOOL MCIAVI_RegisterClass ( void  )

Definition at line 93 of file wnd.c.

94{
95 WNDCLASSW wndClass;
96
97 ZeroMemory(&wndClass, sizeof(WNDCLASSW));
98 wndClass.style = CS_DBLCLKS;
100 wndClass.cbWndExtra = sizeof(MCIDEVICEID);
101 wndClass.hInstance = MCIAVI_hInstance;
102 wndClass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
103 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
104 wndClass.lpszClassName = mciaviW;
105
106 if (RegisterClassW(&wndClass)) return TRUE;
108
109 return FALSE;
110}
UINT MCIDEVICEID
Definition: mmsystem.h:959
LPCWSTR lpszClassName
Definition: winuser.h:3185
HBRUSH hbrBackground
Definition: winuser.h:3183
HINSTANCE hInstance
Definition: winuser.h:3180
UINT style
Definition: winuser.h:3176
WNDPROC lpfnWndProc
Definition: winuser.h:3177
int cbWndExtra
Definition: winuser.h:3179
HCURSOR hCursor
Definition: winuser.h:3182
#define ZeroMemory
Definition: winbase.h:1712
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_CLASS_ALREADY_EXISTS
Definition: winerror.h:891
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define CS_DBLCLKS
Definition: winuser.h:651
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2136
#define COLOR_3DFACE
Definition: winuser.h:929
static LRESULT WINAPI MCIAVI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wnd.c:30
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by MCIAVI_drvOpen().

◆ MCIAVI_UnregisterClass()

BOOL MCIAVI_UnregisterClass ( void  )

Definition at line 88 of file wnd.c.

89{
91}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by MCIAVI_drvClose().

◆ MCIAVI_WindowProc()

static LRESULT WINAPI MCIAVI_WindowProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 30 of file wnd.c.

31{
32 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hWnd, uMsg, wParam, lParam);
33
34 switch (uMsg) {
35 case WM_CREATE:
36 SetWindowLongW(hWnd, 0, (LPARAM)((CREATESTRUCTW *)lParam)->lpCreateParams);
37 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
38
39 case WM_DESTROY:
41 SetWindowLongW(hWnd, 0, 0);
42 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
43
44 case WM_ERASEBKGND:
45 {
46 RECT rect;
49 }
50 return 1;
51
52 case WM_PAINT:
53 {
55
56 if (!wma)
57 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
58
60
61 /* the animation isn't playing, don't paint */
62 if (wma->dwStatus == MCI_MODE_NOT_READY)
63 {
65 /* default paint handling */
66 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
67 }
68
69 if (wParam)
71 else
72 {
73 PAINTSTRUCT ps;
74 BeginPaint(hWnd, &ps);
75 MCIAVI_PaintFrame(wma, ps.hdc);
76 EndPaint(hWnd, &ps);
77 }
78
80 }
81 return 1;
82
83 default:
84 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
85 }
86}
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
DWORD WINAPI mciGetDriverData(UINT uDeviceID)
Definition: mci.c:2233
DWORD MCIAVI_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:305
double MCIAVI_PaintFrame(WINE_MCIAVI *wma, HDC hDC)
Definition: mmoutput.c:613
#define MCI_WAIT
Definition: mmsystem.h:730
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694
static HDC
Definition: imagelist.c:92
& rect
Definition: startmenu.cpp:1413
LONG_PTR LPARAM
Definition: windef.h:208
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define BLACK_BRUSH
Definition: wingdi.h:896
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define WM_PAINT
Definition: winuser.h:1620
#define WM_ERASEBKGND
Definition: winuser.h:1625
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1608
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define WM_DESTROY
Definition: winuser.h:1609
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by MCIAVI_RegisterClass().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( mciavi  )

Variable Documentation

◆ mciaviW

const WCHAR mciaviW[] = {'M','C','I','A','V','I',0}
static

Definition at line 28 of file wnd.c.

Referenced by MCIAVI_CreateWindow(), MCIAVI_RegisterClass(), and MCIAVI_UnregisterClass().