mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 03:33:02 +00:00
[BROWSEUI]
- CShellBrowser: Add a standard ShellObjectCreatorInit constructor and make its initializer take a pidl and flags. - Move BrowserThreadProc to desktopipc.cpp where the lifetime of the browser thread will be managed. svn path=/trunk/; revision=73129
This commit is contained in:
parent
24fcf531e7
commit
6cd367f86e
3 changed files with 69 additions and 71 deletions
|
@ -10,6 +10,7 @@
|
||||||
#define USE_CUSTOM_INTERNETTOOLBAR 1
|
#define USE_CUSTOM_INTERNETTOOLBAR 1
|
||||||
|
|
||||||
/* Constructors for the classes that are not exported */
|
/* Constructors for the classes that are not exported */
|
||||||
|
HRESULT CShellBrowser_CreateInstance(LPITEMIDLIST pidl, DWORD dwFlags, REFIID riid, void **ppv);
|
||||||
HRESULT CTravelLog_CreateInstance(REFIID riid, void **ppv);
|
HRESULT CTravelLog_CreateInstance(REFIID riid, void **ppv);
|
||||||
HRESULT CBaseBar_CreateInstance(REFIID riid, void **ppv, BOOL vertical);
|
HRESULT CBaseBar_CreateInstance(REFIID riid, void **ppv, BOOL vertical);
|
||||||
HRESULT CBaseBarSite_CreateInstance(REFIID riid, void **ppv, BOOL bVertical);
|
HRESULT CBaseBarSite_CreateInstance(REFIID riid, void **ppv, BOOL bVertical);
|
||||||
|
|
|
@ -28,8 +28,6 @@ struct HNFBlock
|
||||||
UINT pathLength;
|
UINT pathLength;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter);
|
|
||||||
|
|
||||||
class CProxyDesktop :
|
class CProxyDesktop :
|
||||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||||
public CWindowImpl < CProxyDesktop, CWindow, CFrameWinTraits >
|
public CWindowImpl < CProxyDesktop, CWindow, CFrameWinTraits >
|
||||||
|
@ -345,6 +343,70 @@ cleanup0:
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static HRESULT ExplorerMessageLoop(IEThreadParamBlock * parameters)
|
||||||
|
{
|
||||||
|
CComPtr<IBrowserService2> browser;
|
||||||
|
HRESULT hResult;
|
||||||
|
MSG Msg;
|
||||||
|
BOOL Ret;
|
||||||
|
|
||||||
|
// Tell the thread ref we are using it.
|
||||||
|
if (parameters && parameters->offsetF8)
|
||||||
|
parameters->offsetF8->AddRef();
|
||||||
|
|
||||||
|
hResult = CShellBrowser_CreateInstance(parameters->directoryPIDL, parameters->dwFlags, IID_PPV_ARG(IBrowserService2, &browser));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return hResult;
|
||||||
|
|
||||||
|
while ((Ret = GetMessage(&Msg, NULL, 0, 0)) != 0)
|
||||||
|
{
|
||||||
|
if (Ret == -1)
|
||||||
|
{
|
||||||
|
// Error: continue or exit?
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Msg.message == WM_QUIT)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (browser->v_MayTranslateAccelerator(&Msg) != S_OK)
|
||||||
|
{
|
||||||
|
TranslateMessage(&Msg);
|
||||||
|
DispatchMessage(&Msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int nrc = browser->Release();
|
||||||
|
if (nrc > 0)
|
||||||
|
{
|
||||||
|
DbgPrint("WARNING: There are %d references to the CShellBrowser active or leaked.\n", nrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.Detach();
|
||||||
|
|
||||||
|
// Tell the thread ref we are not using it anymore.
|
||||||
|
if (parameters && parameters->offsetF8)
|
||||||
|
parameters->offsetF8->Release();
|
||||||
|
|
||||||
|
return hResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter)
|
||||||
|
{
|
||||||
|
IEThreadParamBlock * parameters = (IEThreadParamBlock *) lpThreadParameter;
|
||||||
|
|
||||||
|
OleInitialize(NULL);
|
||||||
|
ExplorerMessageLoop(parameters);
|
||||||
|
|
||||||
|
/* Destroying the parameters releases the thread reference */
|
||||||
|
SHDestroyIETHREADPARAM(parameters);
|
||||||
|
|
||||||
|
OleUninitialize();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* SHCreateIETHREADPARAM [BROWSEUI.123]
|
* SHCreateIETHREADPARAM [BROWSEUI.123]
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -309,7 +309,7 @@ public:
|
||||||
|
|
||||||
CShellBrowser();
|
CShellBrowser();
|
||||||
~CShellBrowser();
|
~CShellBrowser();
|
||||||
HRESULT Initialize(LPITEMIDLIST pidl, long b, long c, long d);
|
HRESULT Initialize(LPITEMIDLIST pidl, DWORD dwFlags);
|
||||||
public:
|
public:
|
||||||
HRESULT BrowseToPIDL(LPCITEMIDLIST pidl, long flags);
|
HRESULT BrowseToPIDL(LPCITEMIDLIST pidl, long flags);
|
||||||
HRESULT BrowseToPath(IShellFolder *newShellFolder, LPCITEMIDLIST absolutePIDL,
|
HRESULT BrowseToPath(IShellFolder *newShellFolder, LPCITEMIDLIST absolutePIDL,
|
||||||
|
@ -706,7 +706,7 @@ CShellBrowser::~CShellBrowser()
|
||||||
DSA_Destroy(menuDsa);
|
DSA_Destroy(menuDsa);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, long b, long c, long d)
|
HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
CComPtr<IPersistStreamInit> persistStreamInit;
|
CComPtr<IPersistStreamInit> persistStreamInit;
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
@ -3697,72 +3697,7 @@ LRESULT CShellBrowser::RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT ExplorerMessageLoop(IEThreadParamBlock * parameters)
|
HRESULT CShellBrowser_CreateInstance(LPITEMIDLIST pidl, DWORD dwFlags, REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
CComPtr<CShellBrowser> theCabinet;
|
return ShellObjectCreatorInit<CShellBrowser>(pidl, dwFlags, riid, ppv);
|
||||||
HRESULT hResult;
|
|
||||||
MSG Msg;
|
|
||||||
BOOL Ret;
|
|
||||||
|
|
||||||
// Tell the thread ref we are using it.
|
|
||||||
if (parameters && parameters->offsetF8)
|
|
||||||
parameters->offsetF8->AddRef();
|
|
||||||
|
|
||||||
ATLTRY(theCabinet = new CComObject<CShellBrowser>);
|
|
||||||
if (theCabinet == NULL)
|
|
||||||
{
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
hResult = theCabinet->Initialize(parameters->directoryPIDL, 0, 0, 0);
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
while ((Ret = GetMessage(&Msg, NULL, 0, 0)) != 0)
|
|
||||||
{
|
|
||||||
if (Ret == -1)
|
|
||||||
{
|
|
||||||
// Error: continue or exit?
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Msg.message == WM_QUIT)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (theCabinet->v_MayTranslateAccelerator(&Msg) != S_OK)
|
|
||||||
{
|
|
||||||
TranslateMessage(&Msg);
|
|
||||||
DispatchMessage(&Msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int nrc = theCabinet->Release();
|
|
||||||
if (nrc > 0)
|
|
||||||
{
|
|
||||||
DbgPrint("WARNING: There are %d references to the CShellBrowser active or leaked.\n", nrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
theCabinet.Detach();
|
|
||||||
|
|
||||||
// Tell the thread ref we are not using it anymore.
|
|
||||||
if (parameters && parameters->offsetF8)
|
|
||||||
parameters->offsetF8->Release();
|
|
||||||
|
|
||||||
return hResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter)
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
IEThreadParamBlock * parameters = (IEThreadParamBlock *) lpThreadParameter;
|
|
||||||
|
|
||||||
OleInitialize(NULL);
|
|
||||||
|
|
||||||
ATLTRY(hr = ExplorerMessageLoop(parameters));
|
|
||||||
|
|
||||||
OleUninitialize();
|
|
||||||
|
|
||||||
SHDestroyIETHREADPARAM(parameters);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue