mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 12:26:09 +00:00
[EXPLORER]
- Simplify some code by using the IUnknown_ exports of shlwapi and using CComPtr. svn path=/trunk/; revision=65605
This commit is contained in:
parent
71a780a54c
commit
502f155b91
2 changed files with 18 additions and 56 deletions
|
@ -272,55 +272,31 @@ public:
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite)
|
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite)
|
||||||
{
|
{
|
||||||
HRESULT hRet = E_FAIL;
|
HRESULT hRet;
|
||||||
|
HWND hwndSite;
|
||||||
|
|
||||||
TRACE("ITaskBand::SetSite(0x%p)\n", pUnkSite);
|
TRACE("ITaskBand::SetSite(0x%p)\n", pUnkSite);
|
||||||
|
|
||||||
/* Release the current site */
|
hRet = IUnknown_GetWindow(pUnkSite, &hwndSite);
|
||||||
if (m_Site != NULL)
|
if (FAILED(hRet))
|
||||||
{
|
{
|
||||||
m_Site->Release();
|
TRACE("Querying site window failed: 0x%x\n", hRet);
|
||||||
|
return hRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Site = NULL;
|
TRACE("CreateTaskSwitchWnd(Parent: 0x%p)\n", hwndSite);
|
||||||
m_hWnd = NULL;
|
|
||||||
|
|
||||||
if (pUnkSite != NULL)
|
HWND hwndTaskSwitch = CreateTaskSwitchWnd(hwndSite, m_Tray);
|
||||||
|
if (!hwndTaskSwitch)
|
||||||
{
|
{
|
||||||
CComPtr<IOleWindow> OleWindow;
|
ERR("CreateTaskSwitchWnd failed");
|
||||||
|
return E_FAIL;
|
||||||
/* Check if the site supports IOleWindow */
|
|
||||||
hRet = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &OleWindow));
|
|
||||||
if (SUCCEEDED(hRet))
|
|
||||||
{
|
|
||||||
HWND hWndParent = NULL;
|
|
||||||
|
|
||||||
hRet = OleWindow->GetWindow(&hWndParent);
|
|
||||||
if (SUCCEEDED(hRet))
|
|
||||||
{
|
|
||||||
/* Attempt to create the task switch window */
|
|
||||||
|
|
||||||
TRACE("CreateTaskSwitchWnd(Parent: 0x%p)\n", hWndParent);
|
|
||||||
m_hWnd = CreateTaskSwitchWnd(hWndParent, m_Tray);
|
|
||||||
if (m_hWnd != NULL)
|
|
||||||
{
|
|
||||||
m_Site = pUnkSite;
|
|
||||||
hRet = S_OK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TRACE("CreateTaskSwitchWnd() failed!\n");
|
|
||||||
hRet = E_FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TRACE("Querying IOleWindow failed: 0x%x\n", hRet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hRet;
|
m_Site = pUnkSite;
|
||||||
|
m_hWnd = hwndTaskSwitch;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE GetSite(
|
virtual HRESULT STDMETHODCALLTYPE GetSite(
|
||||||
|
|
|
@ -350,23 +350,9 @@ public:
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE AddBand(IN IUnknown *punk)
|
virtual HRESULT STDMETHODCALLTYPE AddBand(IN IUnknown *punk)
|
||||||
{
|
{
|
||||||
IOleCommandTarget *pOct;
|
/* Send the DBID_DELAYINIT command to initialize the band to be added */
|
||||||
HRESULT hRet;
|
/* FIXME: Should be delayed */
|
||||||
|
IUnknown_Exec(punk, IID_IDeskBand, DBID_DELAYINIT, 0, NULL, NULL);
|
||||||
hRet = punk->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &pOct));
|
|
||||||
if (SUCCEEDED(hRet))
|
|
||||||
{
|
|
||||||
/* Send the DBID_DELAYINIT command to initialize the band to be added */
|
|
||||||
/* FIXME: Should be delayed */
|
|
||||||
pOct->Exec(
|
|
||||||
&IID_IDeskBand,
|
|
||||||
DBID_DELAYINIT,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
pOct->Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_BandSite->AddBand(punk);
|
return m_BandSite->AddBand(punk);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue