diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:29:28 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:29:28 +0200 |
commit | 75c07011b7c4d06acd7b45dabdcd60ab9d80f385 (patch) | |
tree | 8853c3978dd152ef377e652239448b1352320206 /ui/Taskbar_Seven/taskbar.cpp | |
parent | 5.22 (diff) | |
download | FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.gz FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.bz2 FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.zip |
5.23
Diffstat (limited to 'ui/Taskbar_Seven/taskbar.cpp')
-rw-r--r-- | ui/Taskbar_Seven/taskbar.cpp | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/ui/Taskbar_Seven/taskbar.cpp b/ui/Taskbar_Seven/taskbar.cpp deleted file mode 100644 index 72be7016..00000000 --- a/ui/Taskbar_Seven/taskbar.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * -// ************************************************************************** - -#include "taskbar.h" -#include <map> -#include <string> - -#define WIN32_LEAN_AND_MEAN -#include <zen/com_error.h> -#include <zen/com_ptr.h> - -#include <ShObjIdl.h> - -using namespace zen; - - -namespace -{ -std::wstring lastErrorMessage; - - -ComPtr<ITaskbarList3> getInstance() -{ - ComPtr<ITaskbarList3> taskbarlist; - - HRESULT hr = ::CoCreateInstance(CLSID_TaskbarList, - nullptr, - CLSCTX_ALL, - IID_PPV_ARGS(taskbarlist.init())); - if (FAILED(hr)) - { - lastErrorMessage = formatComError(L"Error calling \"CoCreateInstance\".", hr); - return ComPtr<ITaskbarList3>(); - } - - return taskbarlist; -} -} -//################################################################################################## - - -bool tbseven::setStatus(void* hwnd, //HWND: window assciated to the taskbar icon - TaskBarStatus status) -{ - TBPFLAG flag = TBPF_NORMAL; - switch (status) - { - case STATUS_NOPROGRESS: - flag = TBPF_NOPROGRESS; - break; - case STATUS_INDETERMINATE: - flag = TBPF_INDETERMINATE; - break; - case STATUS_NORMAL: - flag = TBPF_NORMAL; - break; - case STATUS_ERROR: - flag = TBPF_ERROR; - break; - case STATUS_PAUSED: - flag = TBPF_PAUSED; - break; - } - - ComPtr<ITaskbarList3> taskbarlist = getInstance(); - if (!taskbarlist) //error msg already set - return false; - - HRESULT hr = taskbarlist->SetProgressState(static_cast<HWND>(hwnd), //[in] HWND hwnd, - flag); //[in] TBPFLAG tbpFlags - if (FAILED(hr)) - { - lastErrorMessage = formatComError(L"Error calling \"SetProgressState\".", hr); - return false; - } - - return true; -} - - -bool tbseven::setProgress(void* hwnd, //HWND: window assciated to the taskbar icon - size_t current, - size_t total) -{ - ComPtr<ITaskbarList3> taskbarlist = getInstance(); - if (!taskbarlist) //error msg already set - return false; - - HRESULT hr = taskbarlist->SetProgressValue( - static_cast<HWND>(hwnd), //[in] HWND hwnd, - current, //[in] ULONGLONG ullCompleted, - total); //[in] ULONGLONG ullTotal - if (FAILED(hr)) - { - lastErrorMessage = formatComError(L"Error calling \"SetProgressValue\".", hr); - return false; - } - - return true; -} - - -void tbseven::getLastError(wchar_t* buffer, size_t bufferSize) -{ - if (bufferSize > 0) - { - size_t endPos = lastErrorMessage.copy(buffer, bufferSize - 1); - buffer[endPos] = 0; - } -} |