diff options
Diffstat (limited to 'shared/Taskbar_Seven/taskbar.cpp')
-rw-r--r-- | shared/Taskbar_Seven/taskbar.cpp | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/shared/Taskbar_Seven/taskbar.cpp b/shared/Taskbar_Seven/taskbar.cpp index f5249e08..c9a2e7df 100644 --- a/shared/Taskbar_Seven/taskbar.cpp +++ b/shared/Taskbar_Seven/taskbar.cpp @@ -13,7 +13,7 @@ #include <map> #include <string> #include <comdef.h> - +#include "../com_error.h" namespace { @@ -24,27 +24,7 @@ void writeString(const std::wstring& input, wchar_t* output, size_t outputBuffer output[newSize-1] = 0; //if output buffer is too small... } - -std::wstring numberToHexString(const long number) -{ - wchar_t result[100]; - swprintf(result, 100, L"0x%08x", number); - return std::wstring(result); -} - - -std::wstring writeErrorMsg(const wchar_t* input, HRESULT hr) -{ - std::wstring output(input); - output += L" ("; - output += numberToHexString(hr); - output += L": "; - output += _com_error(hr).ErrorMessage(); - output += L")"; - return output; -} - - +using Util::generateErrorMsg; using TaskbarSeven::TBHandle; typedef std::map<TBHandle, ITaskbarList3*> TaskBarHandleMap; @@ -70,7 +50,7 @@ TaskbarSeven::TBHandle TaskbarSeven::init() //call on app initializaiton; return IID_PPV_ARGS(&pto)); if (FAILED(hr)) { - lastErrorMessage = writeErrorMsg(L"Error calling \"CoCreateInstance\".", hr); + lastErrorMessage = generateErrorMsg(L"Error calling \"CoCreateInstance\".", hr); return 0; } @@ -123,7 +103,7 @@ bool TaskbarSeven::setStatus(TBHandle handle, flag); //[in] TBPFLAG tbpFlags if (FAILED(hr)) { - lastErrorMessage = writeErrorMsg(L"Error calling \"SetProgressState\".", hr); + lastErrorMessage = generateErrorMsg(L"Error calling \"SetProgressState\".", hr); return false; } } @@ -146,7 +126,7 @@ bool TaskbarSeven::setProgress(TBHandle handle, total); //[in] ULONGLONG ullTotal if (FAILED(hr)) { - lastErrorMessage = writeErrorMsg(L"Error calling \"SetProgressValue\".", hr); + lastErrorMessage = generateErrorMsg(L"Error calling \"SetProgressValue\".", hr); return false; } } |