mirror of
https://github.com/reactos/reactos.git
synced 2025-08-01 18:43:30 +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)
|
||||
{
|
||||
HRESULT hRet = E_FAIL;
|
||||
HRESULT hRet;
|
||||
HWND hwndSite;
|
||||
|
||||
TRACE("ITaskBand::SetSite(0x%p)\n", pUnkSite);
|
||||
|
||||
/* Release the current site */
|
||||
if (m_Site != NULL)
|
||||
hRet = IUnknown_GetWindow(pUnkSite, &hwndSite);
|
||||
if (FAILED(hRet))
|
||||
{
|
||||
m_Site->Release();
|
||||
TRACE("Querying site window failed: 0x%x\n", hRet);
|
||||
return hRet;
|
||||
}
|
||||
|
||||
m_Site = NULL;
|
||||
m_hWnd = NULL;
|
||||
TRACE("CreateTaskSwitchWnd(Parent: 0x%p)\n", hwndSite);
|
||||
|
||||
if (pUnkSite != NULL)
|
||||
HWND hwndTaskSwitch = CreateTaskSwitchWnd(hwndSite, m_Tray);
|
||||
if (!hwndTaskSwitch)
|
||||
{
|
||||
CComPtr<IOleWindow> OleWindow;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
ERR("CreateTaskSwitchWnd failed");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return hRet;
|
||||
m_Site = pUnkSite;
|
||||
m_hWnd = hwndTaskSwitch;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSite(
|
||||
|
|
|
@ -350,23 +350,9 @@ public:
|
|||
|
||||
virtual HRESULT STDMETHODCALLTYPE AddBand(IN IUnknown *punk)
|
||||
{
|
||||
IOleCommandTarget *pOct;
|
||||
HRESULT hRet;
|
||||
|
||||
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();
|
||||
}
|
||||
/* Send the DBID_DELAYINIT command to initialize the band to be added */
|
||||
/* FIXME: Should be delayed */
|
||||
IUnknown_Exec(punk, IID_IDeskBand, DBID_DELAYINIT, 0, NULL, NULL);
|
||||
|
||||
return m_BandSite->AddBand(punk);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue