From 2ae461e400d7dbc63b8a7e8a7f8f841381194416 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 27 Feb 2004 04:32:16 +0000 Subject: [PATCH] Use some heuristics to decide what type of MCIWNDM_OPEN message to use. --- dlls/msvideo/mciwnd.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dlls/msvideo/mciwnd.c b/dlls/msvideo/mciwnd.c index 1047bcba25d..ff42f43a65f 100644 --- a/dlls/msvideo/mciwnd.c +++ b/dlls/msvideo/mciwnd.c @@ -108,6 +108,8 @@ HWND VFWAPIV MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance, MCIWndRegisterClass(); + if (!hInstance) hInstance = GetModuleHandleW(0); + if (hwndParent) dwStyle |= WS_VISIBLE | WS_BORDER /*| WS_CHILD*/; else @@ -255,6 +257,10 @@ static LRESULT MCIWND_Create(HWND hWnd, LPCREATESTRUCTW cs) SetWindowLongW(hWnd, 0, (LPARAM)mwi); mwi->dwStyle = cs->style; + /* There is no need to show stats if there is no caption */ + if ((mwi->dwStyle & WS_CAPTION) != WS_CAPTION) + mwi->dwStyle &= ~MCIWNDF_SHOWALL; + mwi->hWnd = hWnd; mwi->hwndOwner = cs->hwndParent; mwi->active_timer = 500; @@ -306,8 +312,18 @@ static LRESULT MCIWND_Create(HWND hWnd, LPCREATESTRUCTW cs) } else lParam = (LPARAM)cs->lpCreateParams; - /* yes, A variant of the message */ - SendMessageW(hWnd, MCIWNDM_OPENA, 0, lParam); + + /* If it's our internal caption, file name is a unicode string */ + if (cs->lpszClass == mciWndClassW) + SendMessageW(hWnd, MCIWNDM_OPENW, 0, lParam); + else + { + /* Otherwise let's try to figure out what string format is used */ + HWND parent = cs->hwndParent; + if (!parent) parent = GetWindow(hWnd, GW_OWNER); + + SendMessageW(hWnd, IsWindowUnicode(parent) ? MCIWNDM_OPENW : MCIWNDM_OPENA, 0, lParam); + } } return 0;