https://git.reactos.org/?p=reactos.git;a=commitdiff;h=62c33fbf69e6bc48d454d…
commit 62c33fbf69e6bc48d454df8ed5361fbfa1a6539b
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Sat Nov 24 19:41:42 2018 +0200
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Tue Nov 27 10:33:57 2018 +0200
[BROWSEUI] CShellBrowser: Don't pass any parameters to Initialize. Let users use
the BrowseObject method instead.
---
dll/win32/browseui/browseui.h | 2 +-
dll/win32/browseui/desktopipc.cpp | 30 ++++++++++++++++++------------
dll/win32/browseui/shellbrowser.cpp | 27 ++++++++++++++-------------
3 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/dll/win32/browseui/browseui.h b/dll/win32/browseui/browseui.h
index e1d62de647..5635b8f5cf 100644
--- a/dll/win32/browseui/browseui.h
+++ b/dll/win32/browseui/browseui.h
@@ -17,7 +17,7 @@ HRESULT CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv);
HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv);
HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv);
HRESULT CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv);
-HRESULT CShellBrowser_CreateInstance(LPITEMIDLIST pidl, DWORD dwFlags, REFIID riid, void
**ppv);
+HRESULT CShellBrowser_CreateInstance(REFIID riid, void **ppv);
HRESULT CTravelLog_CreateInstance(REFIID riid, void **ppv);
HRESULT CBaseBar_CreateInstance(REFIID riid, void **ppv, BOOL vertical);
HRESULT CBaseBarSite_CreateInstance(REFIID riid, void **ppv, BOOL bVertical);
diff --git a/dll/win32/browseui/desktopipc.cpp b/dll/win32/browseui/desktopipc.cpp
index c82f4cd30d..7c794b6133 100644
--- a/dll/win32/browseui/desktopipc.cpp
+++ b/dll/win32/browseui/desktopipc.cpp
@@ -343,8 +343,7 @@ cleanup0:
static HRESULT ExplorerMessageLoop(IEThreadParamBlock * parameters)
{
- CComPtr<IBrowserService2> browser;
- HRESULT hResult;
+ HRESULT hResult;
MSG Msg;
BOOL Ret;
@@ -366,26 +365,33 @@ static HRESULT ExplorerMessageLoop(IEThreadParamBlock * parameters)
ILRemoveLastID(parameters->directoryPIDL);
}
- hResult = CShellBrowser_CreateInstance(parameters->directoryPIDL, wFlags,
IID_PPV_ARG(IBrowserService2, &browser));
+ CComPtr<IShellBrowser> psb;
+ hResult = CShellBrowser_CreateInstance(IID_PPV_ARG(IShellBrowser, &psb));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+
+ hResult = psb->BrowseObject(parameters->directoryPIDL, wFlags);
if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
if (pidlSelect != NULL)
{
- CComPtr<IShellBrowser> pisb;
- hResult = browser->QueryInterface(IID_PPV_ARG(IShellBrowser, &pisb));
+ CComPtr<IShellView> shellView;
+ hResult = psb->QueryActiveShellView(&shellView);
if (SUCCEEDED(hResult))
{
- CComPtr<IShellView> shellView;
- hResult = pisb->QueryActiveShellView(&shellView);
- if (SUCCEEDED(hResult))
- {
- shellView->SelectItem(pidlSelect, SVSI_SELECT|SVSI_ENSUREVISIBLE);
- }
+ shellView->SelectItem(pidlSelect, SVSI_SELECT|SVSI_ENSUREVISIBLE);
}
ILFree(pidlSelect);
}
+ CComPtr<IBrowserService2> browser;
+ hResult = psb->QueryInterface(IID_PPV_ARG(IBrowserService2, &browser));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+
+ psb.Release();
+
while ((Ret = GetMessage(&Msg, NULL, 0, 0)) != 0)
{
if (Ret == -1)
@@ -617,7 +623,7 @@ BOOL WINAPI SHCreateFromDesktop(ExplorerCommandLineParseResults *
parseResults)
}
parameters->dwFlags = parseResults->dwFlags;
- parameters->offset8 = parseResults->offsetC;
+ parameters->offset8 = parseResults->nCmdShow;
LPITEMIDLIST pidl = parseResults->pidlPath ? ILClone(parseResults->pidlPath) :
NULL;
if (!pidl && parseResults->dwFlags & SH_EXPLORER_CMDLINE_FLAG_STRING)
diff --git a/dll/win32/browseui/shellbrowser.cpp b/dll/win32/browseui/shellbrowser.cpp
index 72421a456e..dbafbbe860 100644
--- a/dll/win32/browseui/shellbrowser.cpp
+++ b/dll/win32/browseui/shellbrowser.cpp
@@ -323,7 +323,7 @@ public:
CShellBrowser();
~CShellBrowser();
- HRESULT Initialize(LPITEMIDLIST pidl, DWORD dwFlags);
+ HRESULT Initialize();
public:
HRESULT BrowseToPIDL(LPCITEMIDLIST pidl, long flags);
HRESULT BrowseToPath(IShellFolder *newShellFolder, LPCITEMIDLIST absolutePIDL,
@@ -723,7 +723,7 @@ CShellBrowser::~CShellBrowser()
DSA_Destroy(menuDsa);
}
-HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, DWORD dwFlags)
+HRESULT CShellBrowser::Initialize()
{
CComPtr<IPersistStreamInit> persistStreamInit;
HRESULT hResult;
@@ -792,15 +792,8 @@ HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, DWORD dwFlags)
fStatusBarVisible = true;
- // browse
- hResult = BrowseToPIDL(pidl, BTP_UPDATE_NEXT_HISTORY);
- if (FAILED_UNEXPECTEDLY(hResult))
- return hResult;
-
- if ((dwFlags & SBSP_EXPLOREMODE) != NULL)
- ShowBand(CLSID_ExplorerBand, true);
-
ShowWindow(SW_SHOWNORMAL);
+ UpdateWindow();
return S_OK;
}
@@ -1009,6 +1002,11 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
saveCurrentShellView->DestroyViewWindow();
fCurrentShellViewWindow = newShellViewWindow;
+ if (previousView == NULL)
+ {
+ RepositionBars();
+ }
+
// no use
saveCurrentShellView.Release();
saveCurrentShellFolder.Release();
@@ -2252,7 +2250,10 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::BrowseObject(LPCITEMIDLIST
pidl, UINT w
if ((wFlags & SBSP_EXPLOREMODE) != NULL)
ShowBand(CLSID_ExplorerBand, true);
- return BrowseToPIDL(pidl, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
+ long flags = BTP_UPDATE_NEXT_HISTORY;
+ if (fTravelLog)
+ flags |= BTP_UPDATE_CUR_HISTORY;
+ return BrowseToPIDL(pidl, flags);
}
HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewStateStream(DWORD grfMode, IStream
**ppStrm)
@@ -3782,7 +3783,7 @@ LRESULT CShellBrowser::RelayCommands(UINT uMsg, WPARAM wParam,
LPARAM lParam, BO
return 0;
}
-HRESULT CShellBrowser_CreateInstance(LPITEMIDLIST pidl, DWORD dwFlags, REFIID riid, void
**ppv)
+HRESULT CShellBrowser_CreateInstance(REFIID riid, void **ppv)
{
- return ShellObjectCreatorInit<CShellBrowser>(pidl, dwFlags, riid, ppv);
+ return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
}