Commit 7b56edf9 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

explorer: Implement IShellWindows::FindWindowSW() for non-desktop windows.

parent 54e1559a
......@@ -1064,7 +1064,7 @@ static void test_ShellWindows(void)
VariantInit(&v2);
hr = IShellWindows_FindWindowSW(shellwindows, &v, &v2, SWC_EXPLORER, &ret, 0, &disp);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(!ret, "Got window %#x.\n", ret);
ok(!disp, "Got IDispatch %p.\n", &disp);
......@@ -1075,15 +1075,15 @@ static void test_ShellWindows(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IShellWindows_FindWindowSW(shellwindows, &v, &v2, SWC_EXPLORER, &ret, 0, &disp);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(ret == (LONG)(LONG_PTR)hwnd, "Expected %p, got %#x.\n", hwnd, ret);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(ret == (LONG)(LONG_PTR)hwnd, "Expected %p, got %#x.\n", hwnd, ret);
ok(!disp, "Got IDispatch %p.\n", &disp);
hr = IShellWindows_Revoke(shellwindows, cookie);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellWindows_FindWindowSW(shellwindows, &v, &v2, SWC_EXPLORER, &ret, 0, &disp);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(!ret, "Got window %#x.\n", ret);
ok(!disp, "Got IDispatch %p.\n", &disp);
......
......@@ -1284,26 +1284,49 @@ static HRESULT WINAPI shellwindows_OnActivated(IShellWindows *iface, LONG cookie
return E_NOTIMPL;
}
static HRESULT WINAPI shellwindows_FindWindowSW(IShellWindows *iface, VARIANT *loc,
VARIANT *root, int class, LONG *hwnd, int options, IDispatch **disp)
static HRESULT WINAPI shellwindows_FindWindowSW(IShellWindows *iface, VARIANT *location,
VARIANT *root, int class, LONG *hwnd, int options, IDispatch **disp)
{
TRACE("%s %s 0x%x %p 0x%x %p\n", debugstr_variant(loc), debugstr_variant(root),
class, hwnd, options, disp);
struct shellwindows *sw = impl_from_IShellWindows(iface);
unsigned int i;
TRACE("iface %p, location %p, root %p, class %#x, hwnd %p, options %#x, disp %p.\n",
iface, location, root, class, hwnd, options, disp);
if (class != SWC_DESKTOP)
if (class == SWC_DESKTOP)
{
*hwnd = (LONG)(LONG_PTR)GetDesktopWindow();
if (options & SWFO_NEEDDISPATCH)
{
*disp = (IDispatch *)&desktopshellbrowserwindow.IWebBrowser2_iface;
IDispatch_AddRef(*disp);
}
return S_OK;
}
if (options)
FIXME("Ignoring options %#x.\n", options);
if (V_VT(location) != (VT_ARRAY | VT_UI1))
{
WARN("only SWC_DESKTOP class supported.\n");
FIXME("Unexpected variant type %s.\n", debugstr_vt(V_VT(location)));
return E_NOTIMPL;
}
*hwnd = HandleToLong(GetDesktopWindow());
if (options & SWFO_NEEDDISPATCH)
EnterCriticalSection(&sw->cs);
for (i = 0; i < sw->count; ++i)
{
*disp = (IDispatch*)&desktopshellbrowserwindow.IWebBrowser2_iface;
IDispatch_AddRef(*disp);
if (sw->windows[i].class == class && ILIsEqual(V_ARRAY(location)->pvData, sw->windows[i].pidl))
{
*hwnd = sw->windows[i].hwnd;
LeaveCriticalSection(&sw->cs);
return S_OK;
}
}
return S_OK;
LeaveCriticalSection(&sw->cs);
return S_FALSE;
}
static HRESULT WINAPI shellwindows_OnCreated(IShellWindows *iface, LONG cookie, IUnknown *punk)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment