https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c8f216eafdf97937dbab2…
commit c8f216eafdf97937dbab2ee746418137128a2b33
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Sat Dec 15 16:23:22 2018 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Mon Dec 17 20:38:38 2018 +0100
[BROWSEUI] Add ITaskbarList implementation
CORE-15424
---
dll/win32/browseui/CMakeLists.txt | 2 +
dll/win32/browseui/CTaskbarList.cpp | 94 ++++++++++++++++++++++++++++++++++
dll/win32/browseui/CTaskbarList.h | 49 ++++++++++++++++++
dll/win32/browseui/browseui.cpp | 1 +
dll/win32/browseui/browseui.rc | 1 +
dll/win32/browseui/precomp.h | 1 +
dll/win32/browseui/res/taskbarlist.rgs | 13 +++++
dll/win32/browseui/resource.h | 1 +
8 files changed, 162 insertions(+)
diff --git a/dll/win32/browseui/CMakeLists.txt b/dll/win32/browseui/CMakeLists.txt
index 677544bc5f..8c0de76cf7 100644
--- a/dll/win32/browseui/CMakeLists.txt
+++ b/dll/win32/browseui/CMakeLists.txt
@@ -23,6 +23,8 @@ list(APPEND SOURCE
browseui.cpp
browseuiord.cpp
CAutoComplete.cpp
+ CTaskbarList.cpp
+ CTaskbarList.h
commonbrowser.cpp
desktopipc.cpp
explorerband.cpp
diff --git a/dll/win32/browseui/CTaskbarList.cpp b/dll/win32/browseui/CTaskbarList.cpp
new file mode 100644
index 0000000000..24f6f34b99
--- /dev/null
+++ b/dll/win32/browseui/CTaskbarList.cpp
@@ -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(a)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;
+}
+
diff --git a/dll/win32/browseui/CTaskbarList.h b/dll/win32/browseui/CTaskbarList.h
new file mode 100644
index 0000000000..60cc51abb7
--- /dev/null
+++ b/dll/win32/browseui/CTaskbarList.h
@@ -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(a)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_
diff --git a/dll/win32/browseui/browseui.cpp b/dll/win32/browseui/browseui.cpp
index 98a94c2369..46272d48fd 100644
--- a/dll/win32/browseui/browseui.cpp
+++ b/dll/win32/browseui/browseui.cpp
@@ -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)
diff --git a/dll/win32/browseui/browseui.rc b/dll/win32/browseui/browseui.rc
index aa8c3435a9..28899d1cea 100644
--- a/dll/win32/browseui/browseui.rc
+++ b/dll/win32/browseui/browseui.rc
@@ -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>
diff --git a/dll/win32/browseui/precomp.h b/dll/win32/browseui/precomp.h
index 5ee3ee0745..e646759ef0 100644
--- a/dll/win32/browseui/precomp.h
+++ b/dll/win32/browseui/precomp.h
@@ -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"
diff --git a/dll/win32/browseui/res/taskbarlist.rgs
b/dll/win32/browseui/res/taskbarlist.rgs
new file mode 100644
index 0000000000..607b4070d9
--- /dev/null
+++ b/dll/win32/browseui/res/taskbarlist.rgs
@@ -0,0 +1,13 @@
+HKCR
+{
+ NoRemove CLSID
+ {
+ ForceRemove {56FDF344-FD6D-11D0-958A-006097C9A090} = s 'Task bar
communication'
+ {
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Apartment'
+ }
+ }
+ }
+}
diff --git a/dll/win32/browseui/resource.h b/dll/win32/browseui/resource.h
index dc0d8e62c6..1d9f96af77 100644
--- a/dll/win32/browseui/resource.h
+++ b/dll/win32/browseui/resource.h
@@ -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