[BROWSEUI] Add ITaskbarList implementation

CORE-15424
This commit is contained in:
Mark Jansen 2018-12-15 16:23:22 +01:00
parent 6940d9fdf0
commit c8f216eafd
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
8 changed files with 162 additions and 0 deletions

View file

@ -23,6 +23,8 @@ list(APPEND SOURCE
browseui.cpp
browseuiord.cpp
CAutoComplete.cpp
CTaskbarList.cpp
CTaskbarList.h
commonbrowser.cpp
desktopipc.cpp
explorerband.cpp

View file

@ -0,0 +1,94 @@
/*
* PROJECT: browseui
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: ITaskbarList implementation
* COPYRIGHT: Copyright 2018 Mark Jansen (mark.jansen@reactos.org)
*/
#include "precomp.h"
/***********************************************************************
* ITaskbarList2 implementation
*/
#define TWM_GETTASKSWITCH (WM_USER + 236)
CTaskbarList::CTaskbarList()
: m_hTaskWnd(NULL)
{
m_ShellHookMsg = RegisterWindowMessageW(L"SHELLHOOK");
}
CTaskbarList::~CTaskbarList()
{
}
HWND CTaskbarList::TaskWnd()
{
HWND hTrayWnd;
if (m_hTaskWnd && ::IsWindow(m_hTaskWnd))
return m_hTaskWnd;
hTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL);
if (hTrayWnd)
{
m_hTaskWnd = (HWND)SendMessageW(hTrayWnd, TWM_GETTASKSWITCH, 0L, 0L);
}
return m_hTaskWnd;
}
void CTaskbarList::SendTaskWndShellHook(WPARAM wParam, HWND hWnd)
{
HWND hTaskWnd = TaskWnd();
if (hTaskWnd && m_ShellHookMsg)
::SendMessageW(hTaskWnd, m_ShellHookMsg, wParam, (LPARAM)hWnd);
}
HRESULT WINAPI CTaskbarList::MarkFullscreenWindow(HWND hwnd, BOOL fFullscreen)
{
UNIMPLEMENTED;
return E_NOTIMPL;
}
/***********************************************************************
* ITaskbarList implementation
*/
HRESULT WINAPI CTaskbarList::HrInit()
{
if (m_ShellHookMsg == NULL)
return E_OUTOFMEMORY;
if (!TaskWnd())
return E_HANDLE;
return S_OK;
}
HRESULT WINAPI CTaskbarList::AddTab(HWND hwnd)
{
SendTaskWndShellHook(HSHELL_WINDOWCREATED, hwnd);
return S_OK;
}
HRESULT WINAPI CTaskbarList::DeleteTab(HWND hwnd)
{
SendTaskWndShellHook(HSHELL_WINDOWDESTROYED, hwnd);
return S_OK;
}
HRESULT WINAPI CTaskbarList::ActivateTab(HWND hwnd)
{
SendTaskWndShellHook(HSHELL_WINDOWACTIVATED, hwnd);
return S_OK;
}
HRESULT WINAPI CTaskbarList::SetActiveAlt(HWND hwnd)
{
UNIMPLEMENTED;
return E_NOTIMPL;
}

View file

@ -0,0 +1,49 @@
/*
* PROJECT: browseui
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: ITaskbarList header
* COPYRIGHT: Copyright 2018 Mark Jansen (mark.jansen@reactos.org)
*/
#ifndef _CTASKBARLIST_H_
#define _CTASKBARLIST_H_
class CTaskbarList :
public CComCoClass<CTaskbarList, &CLSID_TaskbarList>,
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public ITaskbarList2
{
HWND m_hTaskWnd;
UINT m_ShellHookMsg;
HWND TaskWnd();
void SendTaskWndShellHook(WPARAM wParam, HWND hWnd);
public:
CTaskbarList();
virtual ~CTaskbarList();
/*** ITaskbarList2 methods ***/
virtual HRESULT WINAPI MarkFullscreenWindow(HWND hwnd, BOOL fFullscreen);
/*** ITaskbarList methods ***/
virtual HRESULT STDMETHODCALLTYPE HrInit();
virtual HRESULT STDMETHODCALLTYPE AddTab(HWND hwnd);
virtual HRESULT STDMETHODCALLTYPE DeleteTab(HWND hwnd);
virtual HRESULT STDMETHODCALLTYPE ActivateTab(HWND hwnd);
virtual HRESULT STDMETHODCALLTYPE SetActiveAlt(HWND hwnd);
DECLARE_REGISTRY_RESOURCEID(IDR_TASKBARLIST)
DECLARE_NOT_AGGREGATABLE(CTaskbarList)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CTaskbarList)
COM_INTERFACE_ENTRY_IID(IID_ITaskbarList2, ITaskbarList2)
COM_INTERFACE_ENTRY_IID(IID_ITaskbarList, ITaskbarList)
END_COM_MAP()
};
#endif // _CTASKBARLIST_H_

View file

@ -141,6 +141,7 @@ OBJECT_ENTRY(CLSID_CCommonBrowser, CCommonBrowser)
OBJECT_ENTRY(CLSID_GlobalFolderSettings, CGlobalFolderSettings)
OBJECT_ENTRY(CLSID_InternetToolbar, CInternetToolbar)
OBJECT_ENTRY(CLSID_CRegTreeOptions, CRegTreeOptions)
OBJECT_ENTRY(CLSID_TaskbarList, CTaskbarList)
OBJECT_ENTRY(CLSID_ExplorerBand, CExplorerBand)
OBJECT_ENTRY(CLSID_ProgressDialog, CProgressDialog)
OBJECT_ENTRY(CLSID_ISFBand, CISFBand)

View file

@ -47,6 +47,7 @@ IDR_AUTOCOMPLETE REGISTRY "res/autocomplete.rgs"
IDR_ACLISTISF REGISTRY "res/shellautocomplete.rgs"
IDR_ISFBAND REGISTRY "res/isfband.rgs"
IDR_ACLCUSTOMMRU REGISTRY "res/custommru.rgs"
IDR_TASKBARLIST REGISTRY "res/taskbarlist.rgs"
#include <reactos/manifest_dll.rc>

View file

@ -51,6 +51,7 @@
#include "commonbrowser.h"
#include "globalfoldersettings.h"
#include "regtreeoptions.h"
#include "CTaskbarList.h"
#include "explorerband.h"
#include "CProgressDialog.h"
#include "browseui.h"

View file

@ -0,0 +1,13 @@
HKCR
{
NoRemove CLSID
{
ForceRemove {56FDF344-FD6D-11D0-958A-006097C9A090} = s 'Task bar communication'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
}
}
}

View file

@ -104,6 +104,7 @@
#define IDR_ACLISTISF 142
#define IDR_ISFBAND 143
#define IDR_ACLCUSTOMMRU 144
#define IDR_TASKBARLIST 145
#define IDS_SMALLICONS 12301
#define IDS_LARGEICONS 12302