summaryrefslogtreecommitdiff
path: root/shared/Taskbar_Seven/taskbar.h
blob: 3b7abc514e33c4c8c5cdc043172c6829df2c247f (plain)
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
69
70
// **************************************************************************
// * 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-2010 ZenJu (zhnmju123 AT gmx.de)                    *
// **************************************************************************
//
#ifndef TASKBAR_SEVEN_DLL_H
#define TASKBAR_SEVEN_DLL_H

#ifdef TASKBAR_SEVEN_DLL_EXPORTS
#define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllexport)
#else
#define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllimport)
#endif


namespace TaskbarSeven
{
enum TaskBarStatus
{
    STATUS_NOPROGRESS,
    STATUS_INDETERMINATE,
    STATUS_NORMAL,
    STATUS_ERROR,
    STATUS_PAUSED
};

typedef size_t TBHandle;


//COM needs to be initialized before calling any of these functions! CoInitializeEx/CoUninitialize
DLL_FUNCTION_DECLARATION
TBHandle init(); //returns handle; 0 on failure

DLL_FUNCTION_DECLARATION
void release(TBHandle handle); //release taskbar handle

DLL_FUNCTION_DECLARATION
bool setStatus(TBHandle handle,
               void* hwnd, //HWND: window assciated to the taskbar icon
               TaskBarStatus status);


DLL_FUNCTION_DECLARATION
bool setProgress(TBHandle handle,
                 void* hwnd, //HWND: window assciated to the taskbar icon
                 size_t current,
                 size_t total);

//if any of the functions above returns 'false', this message returns last error
DLL_FUNCTION_DECLARATION
void getLastError(wchar_t* errorMessage, size_t errorBufferLen);


//function typedefs
typedef TBHandle (*initFct)();
typedef void (*releaseFct)(TBHandle handle);
typedef bool (*setStatusFct)(TBHandle handle, void* hwnd, TaskBarStatus status);
typedef bool (*setProgressFct)(TBHandle handle, void* hwnd, size_t current, size_t total);
typedef void (*getLastErrorFct)(wchar_t* errorMessage, size_t errorBufferLen);

//function names (use const pointers to ensure internal linkage)
const char* const initFctName         = "init";
const char* const releaseFctName      = "release";
const char* const setStatusFctName    = "setStatus";
const char* const setProgressFctName  = "setProgress";
const char* const getLastErrorFctName = "getLastError";
}

#endif //TASKBAR_SEVEN_DLL_H
bgstack15