1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// **************************************************************************
// * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef TASKBAR_SEVEN_DLL_H
#define TASKBAR_SEVEN_DLL_H
#ifdef THUMBNAIL_DLL_EXPORTS
#define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllexport)
#else
#define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllimport)
#endif
#include <zen/build_info.h>
//#include <WinDef.h>
namespace thumb
{
/*
PREREQUISITES:
1. COM must be initialized for the current thread via ::CoInitialize(nullptr) or ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED),
but NOT ::CoInitializeEx(nullptr, COINIT_MULTITHREADED) -> internal access violation crash!
2. call ::FileIconInit() on app start to remedy obscure errors like SHELL_E_WRONG_BITDEPTH (0x80270102)
for certain file types, e.g. lnk, mpg - required on Windows 7 see http://msdn.microsoft.com/en-us/library/ms683212(v=VS.85).aspx
*/
/*--------------
|declarations|
--------------*/
typedef void* HICON;
DLL_FUNCTION_DECLARATION
HICON getThumbnail(const wchar_t* filename, int requestedSize); //return 0 on failure, caller takes ownership!
//Note: not all file types support thumbnails! make sure to implement fallback to file icon!
DLL_FUNCTION_DECLARATION
HICON getIconByIndex(int iconIndex, int shilIconType); //return 0 on failure, caller takes ownership!
/*
"iconType" refers to parameter "iImageList" of ::SHGetImageList(); sample values:
SHIL_SMALL - 16x16, but the size can be customized by the user.
SHIL_EXTRALARGE - 48x48, but the size can be customized by the user.
SHIL_JUMBO - 256x256 pixels; Vista and later only
"iconIndex" as returned by ::SHGetFileInfo()
*/
/*----------
|typedefs|
----------*/
typedef HICON (*FunType_getThumbnail )(const wchar_t* filename, int requestedSize);
typedef HICON (*FunType_getIconByIndex)(int iconIndex, int shilIconType);
/*--------------
|symbol names|
--------------*/
//(use const pointers to ensure internal linkage)
const char funName_getThumbnail [] = "getThumbnail";
const char funName_getIconByIndex[] = "getIconByIndex";
/*---------------
|library names|
---------------*/
inline const wchar_t* getDllName() { return zen::is64BitBuild ? L"Thumbnail_x64.dll" : L"Thumbnail_Win32.dll"; }
}
#endif //TASKBAR_SEVEN_DLL_H
|