32 |
|
|
33 |
HINSTANCE glob_hinst; |
HINSTANCE glob_hinst; |
34 |
|
|
35 |
/* We need a special section in the DLL for storing our shared data */ |
/* We need a special section in the DLL for storing our shared data. |
36 |
|
This shared data is required by the hook function becuase theat |
37 |
|
function is called in the context of the actual thread running the |
38 |
|
hook and thus we need a way to communicate the result of our hook |
39 |
|
function back to us. We use a shared data segment for this. */ |
40 |
|
#ifdef __GNUC__ |
41 |
|
#define ATTR_SEC __attribute__((section (".SHARDAT"), shared)) |
42 |
|
#else |
43 |
|
#define ATTR_SEC |
44 |
#pragma data_seg(".SHARDAT") |
#pragma data_seg(".SHARDAT") |
45 |
static HHOOK cbt_hook = NULL; /* CTB hook handle. */ |
#endif |
46 |
static DWORD tray_proc_id = 0; /* WinPT PID */ |
static HHOOK cbt_hook ATTR_SEC = NULL; /* CTB hook handle. */ |
47 |
static HWND shell_traywnd = 0; /* Tray window handle. */ |
static DWORD tray_proc_id ATTR_SEC = 0; /* WinPT PID */ |
48 |
static HWND curr_focus = NULL; /* Current window focus handle. */ |
static HWND shell_traywnd ATTR_SEC = 0; /* Tray window handle. */ |
49 |
static HWND rebar_w32 = NULL; |
static HWND curr_focus ATTR_SEC = NULL; /* Current window focus handle. */ |
50 |
static HWND mstask_swc = NULL; |
static HWND rebar_w32 ATTR_SEC = NULL; |
51 |
static HWND systab_c32 = NULL; |
static HWND mstask_swc ATTR_SEC = NULL; |
52 |
|
static HWND systab_c32 ATTR_SEC = NULL; |
53 |
|
#ifndef __GNUC__ |
54 |
#pragma data_seg() |
#pragma data_seg() |
55 |
|
#endif |
56 |
|
#undef ATTR_SEC |
57 |
|
|
58 |
|
|
59 |
static unsigned *journ_keys = 0; |
static unsigned *journ_keys = 0; |
60 |
static unsigned key_idx = 0; |
static unsigned key_idx = 0; |
106 |
tray_proc_id = GetCurrentProcessId (); |
tray_proc_id = GetCurrentProcessId (); |
107 |
cbt_hook = SetWindowsHookEx (WH_CBT, PTD_CBT_proc, glob_hinst, 0); |
cbt_hook = SetWindowsHookEx (WH_CBT, PTD_CBT_proc, glob_hinst, 0); |
108 |
if (cbt_hook == NULL) |
if (cbt_hook == NULL) |
|
{ |
|
|
char buf[500]; |
|
|
|
|
|
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError (), |
|
|
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), |
|
|
buf, sizeof buf -1, NULL); |
|
|
MessageBox (NULL, buf, "Error", MB_OK|MB_ICONSTOP); |
|
109 |
return FALSE; |
return FALSE; |
|
} |
|
110 |
|
|
111 |
|
|
112 |
/* Okay, what are we doing here: |
/* Okay, what are we doing here: |
242 |
} |
} |
243 |
|
|
244 |
|
|
|
/* Return version of the PTD library. */ |
|
|
extern "C" const char * |
|
|
PTD_get_version (void) |
|
|
{ |
|
|
return PACKAGE_VERSION; |
|
|
} |
|
|
|
|
|
|
|
245 |
/* Display a JPG picture in the given window at the given point. */ |
/* Display a JPG picture in the given window at the given point. */ |
246 |
extern "C" int |
extern "C" int |
247 |
PTD_jpg_show (HWND hwnd, POINT *p, LPCSTR name) |
PTD_jpg_show (HWND hwnd, POINT *p, LPCSTR name) |
272 |
|
|
273 |
|
|
274 |
|
|
275 |
BOOL WINAPI |
extern "C" int WINAPI |
276 |
DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserv) |
DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserv) |
277 |
{ |
{ |
278 |
switch (reason) { |
switch (reason) { |