diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:16 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:16 +0200 |
commit | bd6336c629841c6db3a6ca53a936d629d34db53b (patch) | |
tree | 3721ef997864108df175ce677a8a7d4342a6f1d2 /shared/Taskbar_Seven/taskbar.cpp | |
parent | 4.0 (diff) | |
download | FreeFileSync-bd6336c629841c6db3a6ca53a936d629d34db53b.tar.gz FreeFileSync-bd6336c629841c6db3a6ca53a936d629d34db53b.tar.bz2 FreeFileSync-bd6336c629841c6db3a6ca53a936d629d34db53b.zip |
4.1
Diffstat (limited to 'shared/Taskbar_Seven/taskbar.cpp')
-rw-r--r-- | shared/Taskbar_Seven/taskbar.cpp | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/shared/Taskbar_Seven/taskbar.cpp b/shared/Taskbar_Seven/taskbar.cpp deleted file mode 100644 index 2a739e6c..00000000 --- a/shared/Taskbar_Seven/taskbar.cpp +++ /dev/null @@ -1,112 +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) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** - -#include "taskbar.h" - -#define WIN32_LEAN_AND_MEAN -#include "windows.h" -#include <ShObjIdl.h> - -#include <map> -#include <string> -#include <comdef.h> -#include "../com_error.h" -#include "../com_ptr.h" -#include "../c_dll.h" - -using namespace util; -using namespace c_dll; - -namespace -{ -std::wstring lastErrorMessage; - - -ComPtr<ITaskbarList3> getInstance() -{ - static ComPtr<ITaskbarList3> taskbarlist; - if (!taskbarlist) - { - HRESULT hr = ::CoCreateInstance(CLSID_TaskbarList, - NULL, - CLSCTX_ALL, - IID_PPV_ARGS(taskbarlist.init())); - if (FAILED(hr)) - lastErrorMessage = generateErrorMsg(L"Error calling \"CoCreateInstance\".", hr); - } - - 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 = generateErrorMsg(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 = generateErrorMsg(L"Error calling \"SetProgressValue\".", hr); - return false; - } - - return true; -} - - -void tbseven::getLastError(wchar_t* errorMessage, size_t errorBufferLen) -{ - writeString(lastErrorMessage, errorMessage, errorBufferLen); -} |