diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:06 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:06 +0200 |
commit | fbe76102e941b9f1edaf236788e42678f05fdf9a (patch) | |
tree | f5f538316019fa89be8dc478103490c3a826f3ac /shared/Taskbar_Seven | |
parent | 3.8 (diff) | |
download | FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.gz FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.bz2 FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.zip |
3.9
Diffstat (limited to 'shared/Taskbar_Seven')
-rw-r--r-- | shared/Taskbar_Seven/Taskbar_Seven.vcxproj | 2 | ||||
-rw-r--r-- | shared/Taskbar_Seven/dll_main.cpp (renamed from shared/Taskbar_Seven/dllmain.cpp) | 16 | ||||
-rw-r--r-- | shared/Taskbar_Seven/taskbar.cpp | 30 |
3 files changed, 13 insertions, 35 deletions
diff --git a/shared/Taskbar_Seven/Taskbar_Seven.vcxproj b/shared/Taskbar_Seven/Taskbar_Seven.vcxproj index db8b6feb..5b04a98c 100644 --- a/shared/Taskbar_Seven/Taskbar_Seven.vcxproj +++ b/shared/Taskbar_Seven/Taskbar_Seven.vcxproj @@ -208,7 +208,7 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="dllmain.cpp"> + <ClCompile Include="dll_main.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> </PrecompiledHeader> <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged> diff --git a/shared/Taskbar_Seven/dllmain.cpp b/shared/Taskbar_Seven/dll_main.cpp index 18bb453d..142e26a2 100644 --- a/shared/Taskbar_Seven/dllmain.cpp +++ b/shared/Taskbar_Seven/dll_main.cpp @@ -7,21 +7,19 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) +//optional: add init/teardown logic here +BOOL APIENTRY DllMain(HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) { - switch (ul_reason_for_call) + switch (fdwReason) { case DLL_PROCESS_ATTACH: + case DLL_PROCESS_DETACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: break; - } + } return TRUE; } - 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; } } |