[PATCH 3/4] explorer: Set the window title to the current directory.

Zebediah Figura z.figura12 at gmail.com
Tue Nov 28 23:52:06 CST 2017


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 programs/explorer/explorer.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/programs/explorer/explorer.c b/programs/explorer/explorer.c
index 3571497..afb565f 100644
--- a/programs/explorer/explorer.c
+++ b/programs/explorer/explorer.c
@@ -259,10 +259,32 @@ static void update_path_box(explorer_info *info)
 static HRESULT WINAPI IExplorerBrowserEventsImpl_fnOnNavigationComplete(IExplorerBrowserEvents *iface, PCIDLIST_ABSOLUTE pidl)
 {
     IExplorerBrowserEventsImpl *This = impl_from_IExplorerBrowserEvents(iface);
+    IShellFolder *parent;
+    PCUITEMID_CHILD child_pidl;
+    HRESULT hres;
+    STRRET strret;
+    WCHAR *name;
+
     ILFree(This->info->pidl);
     This->info->pidl = ILClone(pidl);
     update_path_box(This->info);
-    return S_OK;
+
+    hres = SHBindToParent(pidl, &IID_IShellFolder, (void **)&parent, &child_pidl);
+    if (SUCCEEDED(hres))
+    {
+        hres = IShellFolder_GetDisplayNameOf(parent, child_pidl, SHGDN_FORADDRESSBAR, &strret);
+        if (SUCCEEDED(hres))
+            hres = StrRetToStrW(&strret, child_pidl, &name);
+        if (SUCCEEDED(hres))
+        {
+            SetWindowTextW(This->info->main_window, name);
+            CoTaskMemFree(name);
+        }
+
+        IShellFolder_Release(parent);
+    }
+
+    return hres;
 }
 
 static HRESULT WINAPI IExplorerBrowserEventsImpl_fnOnNavigationFailed(IExplorerBrowserEvents *iface, PCIDLIST_ABSOLUTE pidl)
-- 
2.7.4




More information about the wine-devel mailing list