23 |
#endif |
#endif |
24 |
|
|
25 |
#include <windows.h> |
#include <windows.h> |
|
#include <windows.h> |
|
26 |
|
|
27 |
#include "wptW32API.h" |
#include "wptW32API.h" |
28 |
#include "wptErrors.h" |
#include "wptErrors.h" |
29 |
|
#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 |
|
|
35 |
extern HWND PTD_get_curr_hwnd( void ); |
extern "C" HWND PTD_get_curr_hwnd( void ); |
36 |
extern BOOL PTD_keyb_send( UINT *keys, UINT n_keys ); |
extern "C" BOOL PTD_keyb_send( UINT *keys, UINT n_keys ); |
37 |
int PTD_is_used( void ); |
extern "C" int PTD_is_used( void ); |
38 |
|
|
39 |
static void |
static void |
40 |
clip_clear (void) |
clip_clear (void) |
65 |
return 0; |
return 0; |
66 |
} /* clip_check */ |
} /* clip_check */ |
67 |
|
|
68 |
|
|
69 |
static void |
static void |
70 |
wnd_msg_markall( HWND hwnd ) |
wnd_msg_markall (void) |
71 |
{ |
{ |
72 |
unsigned keys[4] = {0}; |
unsigned keys[4] = {0}; |
73 |
|
|
85 |
KEYUP( (BYTE)'A', 0x1e ); |
KEYUP( (BYTE)'A', 0x1e ); |
86 |
KEYUP( VK_CONTROL, 0x1d ); |
KEYUP( VK_CONTROL, 0x1d ); |
87 |
} |
} |
88 |
} /* msg_wm_markall */ |
} |
89 |
|
|
90 |
|
|
91 |
static void |
static void |
92 |
wnd_msg_paste( HWND hwnd ) |
wnd_msg_paste (void) |
93 |
{ |
{ |
94 |
unsigned keys[4] = {0}; |
unsigned keys[4] = {0}; |
95 |
|
|
106 |
KEYUP( (BYTE)'V', 0x2f ); |
KEYUP( (BYTE)'V', 0x2f ); |
107 |
KEYUP( VK_CONTROL, 0x1d ); |
KEYUP( VK_CONTROL, 0x1d ); |
108 |
} |
} |
109 |
} /* msg_wm_paste */ |
} |
110 |
|
|
111 |
|
|
112 |
static void |
static void |
113 |
wnd_msg_copy( HWND hwnd ) |
wnd_msg_copy (void) |
114 |
{ |
{ |
115 |
unsigned keys[4] = {0}; |
unsigned keys[4] = {0}; |
116 |
|
|
117 |
if( PTD_is_used() ) { |
if (PTD_is_used ()) { |
118 |
keys[0] = VK_CONTROL | 0x8000; |
keys[0] = VK_CONTROL | 0x8000; |
119 |
keys[1] = 'C' | 0x8000; |
keys[1] = 'C' | 0x8000; |
120 |
keys[2] = 'C'; |
keys[2] = 'C'; |
203 |
} |
} |
204 |
|
|
205 |
/* The last try is to send a mark all and copy to clipboard command */ |
/* The last try is to send a mark all and copy to clipboard command */ |
206 |
wnd_msg_markall( hwnd ); |
wnd_msg_markall (); |
207 |
wnd_msg_copy( hwnd ); |
wnd_msg_copy (); |
208 |
if( !clip_check( ) ) |
if( !clip_check( ) ) |
209 |
rc = 0; |
rc = 0; |
210 |
|
|
236 |
lost = SetFocus( hwnd ); |
lost = SetFocus( hwnd ); |
237 |
|
|
238 |
wnd_msg_em_set_pos( hwnd, 0 ); |
wnd_msg_em_set_pos( hwnd, 0 ); |
239 |
wnd_msg_paste( hwnd ); |
wnd_msg_paste (); |
240 |
wnd_msg_em_set_pos( hwnd, 1 ); |
wnd_msg_em_set_pos( hwnd, 1 ); |
241 |
|
|
242 |
AttachThreadInput( GetCurrentThreadId(), |
AttachThreadInput( GetCurrentThreadId(), |