Use some heuristics to decide what type of MCIWNDM_OPEN message to use
Dmitry Timoshkov
dmitry at baikal.ru
Thu Feb 26 02:09:18 CST 2004
Hello,
There is no way to directly decide what kind of string is in CREATESTRUCT's
lpCreateParams. My tests show that msvfw32 from win2k uses some heuristics
for that, but I haven't managed to figure out what exactly it does.
My approach works as well.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Use some heuristics to decide what type of MCIWNDM_OPEN message to use.
--- cvs/hq/wine/dlls/msvideo/mciwnd.c 2004-02-05 16:01:54.000000000 +0800
+++ wine/dlls/msvideo/mciwnd.c 2004-02-26 15:39:10.000000000 +0800
@@ -108,6 +108,8 @@ HWND VFWAPIV MCIWndCreateW(HWND hwndPare
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,
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,
}
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;
More information about the wine-patches
mailing list