29 |
#include "wptVersion.h" |
#include "wptVersion.h" |
30 |
|
|
31 |
#define KEYDOWN(vcode, scode) keybd_event ((vcode), (scode), 0, 0) |
#define KEYDOWN(vcode, scode) keybd_event ((vcode), (scode), 0, 0) |
32 |
#define KEYUP(vcode, scode) keybd_event ((vcode), (scode), KEYEVENTF_KEYUP, 0) |
#define KEYUP(vcode, scode) keybd_event ((vcode), (scode), KEYEVENTF_KEYUP, 0) |
33 |
|
|
|
|
|
34 |
extern "C" HWND PTD_get_curr_hwnd (void); |
extern "C" HWND PTD_get_curr_hwnd (void); |
35 |
extern "C" BOOL PTD_keyb_send (UINT *keys, UINT n_keys); |
extern "C" BOOL PTD_keyb_send (UINT *keys, UINT n_keys); |
36 |
extern "C" int PTD_is_used (void); |
extern "C" int PTD_is_used (void); |
73 |
static void |
static void |
74 |
wnd_msg_selectall (void) |
wnd_msg_selectall (void) |
75 |
{ |
{ |
76 |
unsigned keys[4] = {0}; |
unsigned int keys[4] = {0}; |
77 |
|
|
78 |
if (PTD_is_used ()) { |
if (PTD_is_used ()) { |
79 |
keys[0] = VK_CONTROL | 0x8000; |
keys[0] = VK_CONTROL | 0x8000; |
96 |
static void |
static void |
97 |
wnd_msg_paste (void) |
wnd_msg_paste (void) |
98 |
{ |
{ |
99 |
unsigned keys[4] = {0}; |
unsigned int keys[4] = {0}; |
100 |
|
|
101 |
if (PTD_is_used ()) { |
if (PTD_is_used ()) { |
102 |
keys[0] = VK_CONTROL | 0x8000; |
keys[0] = VK_CONTROL | 0x8000; |
118 |
static void |
static void |
119 |
wnd_msg_copy (void) |
wnd_msg_copy (void) |
120 |
{ |
{ |
121 |
unsigned keys[4] = {0}; |
unsigned int keys[4] = {0}; |
122 |
|
|
123 |
if (PTD_is_used ()) { |
if (PTD_is_used ()) { |
124 |
keys[0] = VK_CONTROL | 0x8000; |
keys[0] = VK_CONTROL | 0x8000; |
125 |
keys[1] = 'C' | 0x8000; |
keys[1] = 'C' | 0x8000; |
126 |
keys[2] = 'C'; |
keys[2] = 'C'; |
127 |
keys[3] = VK_CONTROL; |
keys[3] = VK_CONTROL; |
128 |
PTD_keyb_send( keys, 4 ); |
PTD_keyb_send (keys, 4); |
129 |
} |
} |
130 |
else { |
else { |
131 |
KEYDOWN( VK_CONTROL, 0x1d ); |
KEYDOWN (VK_CONTROL, 0x1d); |
132 |
KEYDOWN( (BYTE)'C', 0x2e ); |
KEYDOWN ((BYTE)'C', 0x2e); |
133 |
KEYUP( (BYTE)'C', 0x2e ); |
KEYUP ((BYTE)'C', 0x2e); |
134 |
KEYUP( VK_CONTROL, 0x1d ); |
KEYUP (VK_CONTROL, 0x1d); |
135 |
} |
} |
136 |
} |
} |
137 |
|
|
174 |
} |
} |
175 |
|
|
176 |
|
|
177 |
|
/* Retrieve the contents of the current window based on |
178 |
|
the old window handle @old_hwnd and store the information |
179 |
|
in @ctx. |
180 |
|
A return value of 0 indicates a problem. */ |
181 |
int |
int |
182 |
get_window_contents (HWND old_hwnd, curr_wnd_ctx *ctx, int *r_hotkey) |
get_window_contents (HWND old_hwnd, curr_wnd_ctx *ctx, int *r_hotkey) |
183 |
{ |
{ |
228 |
} |
} |
229 |
|
|
230 |
|
|
231 |
|
/* Restore the clipboard contents to the window handle given |
232 |
|
in @ctx and reset the current window to @old_hwnd if possible. */ |
233 |
int |
int |
234 |
set_window_contents (HWND old_hwnd, curr_wnd_ctx *ctx) |
set_window_contents (HWND old_hwnd, curr_wnd_ctx *ctx) |
235 |
{ |
{ |
250 |
wnd_msg_paste (); |
wnd_msg_paste (); |
251 |
wnd_msg_em_set_pos (hwnd, 1); |
wnd_msg_em_set_pos (hwnd, 1); |
252 |
|
|
253 |
AttachThreadInput( GetCurrentThreadId(), |
AttachThreadInput (GetCurrentThreadId(), |
254 |
GetWindowThreadProcessId( hwnd, NULL ), |
GetWindowThreadProcessId (hwnd, NULL), |
255 |
FALSE ); |
FALSE); |
256 |
|
|
257 |
SetForegroundWindow( lost ); |
SetForegroundWindow (lost); |
258 |
|
|
259 |
return 0; |
return 0; |
260 |
} |
} |