ReactOS 0.4.15-dev-7918-g2a2556c
wclickat.c
Go to the documentation of this file.
1/*----------------------------------------------------------------------------
2** wclickat.c
3** Utilty to send clicks to Wine Windows
4**
5** See usage() for usage instructions.
6**
7**---------------------------------------------------------------------------
8** Copyright 2004 Jozef Stefanka for CodeWeavers, Inc.
9** Copyright 2005 Dmitry Timoshkov for CodeWeavers, Inc.
10** Copyright 2005 Francois Gouget for CodeWeavers, Inc.
11**
12** This program is free software; you can redistribute it and/or modify
13** it under the terms of the GNU General Public License as published by
14** the Free Software Foundation; either version 2 of the License, or
15** (at your option) any later version.
16**
17** This program is distributed in the hope that it will be useful,
18** but WITHOUT ANY WARRANTY; without even the implied warranty of
19** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20** GNU General Public License for more details.
21**
22** You should have received a copy of the GNU General Public License
23** along with this program; if not, write to the Free Software
24** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25**
26**--------------------------------------------------------------------------*/
27
28
29#include <windows.h>
30#include <windowsx.h>
31#include <stdio.h>
32#include <ctype.h>
33
34
35#define APP_NAME "wclickat"
36#define DEFAULT_DELAY 500
37#define DEFAULT_REPEAT 1000
38
39#define ARRAY_LENGTH(array) (sizeof(array)/sizeof((array)[0]))
40
41static const WCHAR STATIC_CLASS[]={'s','t','a','t','i','c','\0'};
42
43/*----------------------------------------------------------------------------
44** Global variables
45**--------------------------------------------------------------------------*/
46
47#define RC_RUNNING -1
48#define RC_SUCCESS 0
49#define RC_INVALID_ARGUMENTS 1
50#define RC_NODISPLAY 2
51#define RC_TIMEOUT 3
52static int status;
53
54typedef enum
55{
63
66static long g_control_id = 0;
69static long g_x = -1;
70static long g_y = -1;
71static long g_dragto_x = -1;
72static long g_dragto_y = -1;
73static long g_disabled = 0;
74
75static long g_delay = DEFAULT_DELAY;
76static long g_timeout = 0;
77static long g_repeat = 0;
78static long g_untildeath = 0;
80
81
82/*
83 * Provide some basic debugging support.
84 */
85#ifdef __GNUC__
86#define __PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
87#else
88#define __PRINTF_ATTR(fmt,args)
89#endif
90static int debug_on=0;
91static int init_debug()
92{
93 char* str=getenv("CXTEST_DEBUG");
94 if (str && strstr(str, "+wclickat"))
95 debug_on=1;
96 return debug_on;
97}
98
99static void cxlog(const char* format, ...) __PRINTF_ATTR(1,2);
100static void cxlog(const char* format, ...)
101{
103
104 if (debug_on)
105 {
108 va_end(valist);
109 }
110}
111
112/*----------------------------------------------------------------------------
113** usage
114**--------------------------------------------------------------------------*/
115static void usage(void)
116{
117 fprintf(stderr, "%s - Utility to send clicks to Wine Windows.\n", APP_NAME);
118 fprintf(stderr, "----------------------------------------------\n");
119 fprintf(stderr, "Usage:\n");
120 fprintf(stderr, " %s action --winclass class --wintitle title [--timeout ms]\n",APP_NAME);
121 fprintf(stderr, " %*.*s [--ctrlclas class] [--ctrlcaption caption] [--ctrlid id]\n", strlen(APP_NAME) + 3, strlen(APP_NAME) + 3, "");
122 fprintf(stderr, " %*.*s [--position XxY] [--delay ms] [--untildeath] [--repeat ms]\n", strlen(APP_NAME) + 3, strlen(APP_NAME) + 3, "");
123 fprintf(stderr, "Where action can be one of:\n");
124 fprintf(stderr, " find Find the specified window or control\n");
125 fprintf(stderr, " button<n> Send a click with the given X button number\n");
126 fprintf(stderr, " click|lclick Synonym for button1 (left click)\n");
127 fprintf(stderr, " mclick Synonym for button2 (middle click)\n");
128 fprintf(stderr, " rclick Synonym for button3 (right click)\n");
129 fprintf(stderr, "\n");
130 fprintf(stderr, "The options are as follows:\n");
131 fprintf(stderr, " --timeout ms How long to wait before failing with a code of %d\n", RC_TIMEOUT);
132 fprintf(stderr, " --winclass class Class name of the top-level window of interest\n");
133 fprintf(stderr, " --wintitle title Title of the top-level window of interest\n");
134 fprintf(stderr, " --ctrlclass name Class name of the control of interest, if any\n");
135 fprintf(stderr, " --ctrlcaption cap A substring of the control's caption\n");
136 fprintf(stderr, " --ctrlid id Id of the control\n");
137 fprintf(stderr, " --position XxY Coordinates for the click, relative to the window / control\n");
138 fprintf(stderr, " --dragto If given, then position specifies start click, and\n");
139 fprintf(stderr, " dragto specifies release coords.\n");
140 fprintf(stderr, " --allow-disabled Match the window or control even hidden or disabled\n");
141 fprintf(stderr, " --delay ms Wait ms milliseconds before clicking. The default is %d\n", DEFAULT_DELAY);
142 fprintf(stderr, " --untildeath Wait until the window disappears\n");
143 fprintf(stderr, " --repeat ms Click every ms milliseconds. The default is %d\n", DEFAULT_REPEAT);
144 fprintf(stderr, "\n");
145 fprintf(stderr, "%s returns %d on success\n", APP_NAME, RC_SUCCESS);
146 fprintf(stderr, "\n");
147 fprintf(stderr, "Environment variable overrides:\n");
148 fprintf(stderr, " CXTEST_TIME_MULTIPLE Specifies a floating multiplier applied to any\n");
149 fprintf(stderr, " delay and timeout parameters.\n");
150}
151
152static const WCHAR* my_strstriW(const WCHAR* haystack, const WCHAR* needle)
153{
154 const WCHAR *h,*n;
155 WCHAR first;
156
157 if (!*needle)
158 return haystack;
159
160 /* Special case the first character because
161 * we will be doing a lot of comparisons with it.
162 */
163 first=towlower(*needle);
164 needle++;
165 while (*haystack)
166 {
167 while (towlower(*haystack)!=first && *haystack)
168 haystack++;
169
170 h=haystack+1;
171 n=needle;
172 while (towlower(*h)==towlower(*n) && *h)
173 {
174 h++;
175 n++;
176 }
177 if (!*n)
178 return haystack;
179 haystack++;
180 }
181 return NULL;
182}
183
185{
186 WCHAR str[1024];
187 HWND* pcontrol;
188
191 return TRUE;
192
194 {
197 return TRUE;
198 }
200 return TRUE;
201
202 /* Check that the control is visible and active */
203 if (!g_disabled)
204 {
206 if (!(style & WS_VISIBLE) || (style & WS_DISABLED))
207 return TRUE;
208 }
209
210 pcontrol = (HWND*)lParam;
211 *pcontrol = hwnd;
212 return FALSE;
213}
214
216{
217 WCHAR str[1024];
218 HWND* pwindow;
219
222 return TRUE;
223
226 return TRUE;
227
228 /* Check that the window is visible and active */
229 if (!g_disabled)
230 {
232 if (!(style & WS_VISIBLE) || (style & WS_DISABLED))
233 return TRUE;
234 }
235
236 /* See if we find the control we want */
237 if (g_control_class)
238 {
239 HWND control = NULL;
241 if (!control)
242 return TRUE;
243 hwnd=control;
244 }
245
246 pwindow = (HWND*)lParam;
247 *pwindow = hwnd;
248 return FALSE;
249}
250
252{
253 HWND hwnd;
254
255 hwnd=NULL;
257 return hwnd;
258}
259
261{
262 WINDOWINFO window_info;
263 long x, y;
264
266 window_info.cbSize=sizeof(window_info);
267 GetWindowInfo(window, &window_info);
268
269 /* The calculations below convert the coordinates so they are absolute
270 * screen coordinates in 'Mickeys' as required by mouse_event.
271 * In mickeys the screen size is always 65535x65535.
272 */
273 x=window_info.rcWindow.left+g_x;
275 x=(window_info.rcWindow.right+window_info.rcWindow.left)/2;
277
278 y=window_info.rcWindow.top+g_y;
280 y=(window_info.rcWindow.bottom+window_info.rcWindow.top)/2;
282
284 if (down) {
286 if ((g_dragto_x > 0) && (g_dragto_y > 0)) {
287 int i;
288 long dx, dy;
289 long step_per_x, step_per_y;
290 long dragto_x, dragto_y;
291
292 dragto_x=window_info.rcWindow.left+g_dragto_x;
293 if (dragto_x<window_info.rcWindow.left || dragto_x>=window_info.rcWindow.right)
294 dragto_x=(window_info.rcWindow.right+window_info.rcWindow.left)/2;
295 dragto_x=(dragto_x << 16)/GetSystemMetrics(SM_CXSCREEN);
296
297 dragto_y=window_info.rcWindow.top+g_dragto_y;
298 if (dragto_y<window_info.rcWindow.top || dragto_y>=window_info.rcWindow.bottom)
299 dragto_y=(window_info.rcWindow.bottom+window_info.rcWindow.top)/2;
300 dragto_y=(dragto_y << 16)/GetSystemMetrics(SM_CYSCREEN);
301
302 dx = g_dragto_x - g_x;
303 dy = g_dragto_y - g_y;
304 step_per_x = dx / 4;
305 step_per_y = dy / 4;
306 for (i = 0; i < 4; i++) {
307 mouse_event(MOUSEEVENTF_MOVE, step_per_x, step_per_y, 0, 0);
308 }
309 x=dragto_x;
310 y=dragto_y;
311 }
312 }
313 if (up)
315}
316
317static void CALLBACK ClickProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
318{
320
321 if (!window)
322 {
323 if (g_untildeath)
324 {
325 /* FIXME: The window / control might just be disabled and if
326 * that's the case we should not exit yet. But I don't expect
327 * --untildeath to be used at all anyway so fixing this can
328 * wait until it becomes necessary.
329 */
331 }
332 else
333 cxlog("The window has disappeared!\n");
334 return;
335 }
336
337 switch (g_action)
338 {
339 case ACTION_FIND:
340 /* Nothing to do */
341 break;
342 case ACTION_LCLICK:
343 cxlog("Sending left click\n");
345 break;
346 case ACTION_MCLICK:
347 cxlog("Sending middle click\n");
349 break;
350 case ACTION_RCLICK:
351 cxlog("Sending right click\n");
353 default:
354 fprintf(stderr, "error: unknown action %d\n", g_action);
355 break;
356 }
357 if (!g_repeat)
359}
360
361static void CALLBACK DelayProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
362{
364 timer_id=0;
365 if (g_repeat)
366 {
367 cxlog("Setting up a timer for --repeat\n");
369 }
370
371 ClickProc(NULL, 0, 0, 0);
372}
373
375{
377 if (!window)
378 return;
379
380 cxlog("Found the window\n");
381 if (g_delay)
382 {
383 cxlog("Waiting for a bit\n");
386 do_click(window, 0,0);
387 }
388 else
389 {
390 DelayProc(NULL, 0, 0, 0);
391 }
392}
393
394static void CALLBACK TimeoutProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
395{
397}
398
399/*----------------------------------------------------------------------------
400** parse_arguments
401**--------------------------------------------------------------------------*/
402static int arg_get_long(const char** *argv, const char* name, long* value)
403{
404 if (!**argv)
405 {
406 fprintf(stderr, "error: missing argument for '%s'\n", name);
407 return 1;
408 }
409
410 *value=atol(**argv);
411 if (*value < 0)
412 {
413 fprintf(stderr, "error: invalid argument '%s' for '%s'\n",
414 **argv, name);
415 (*argv)++;
416 return 1;
417 }
418 (*argv)++;
419 return 0;
420}
421
422static int arg_get_utf8(const char** *argv, const char* name, WCHAR* *value)
423{
424 int len;
425
426 if (!**argv)
427 {
428 fprintf(stderr, "error: missing argument for '%s'\n", name);
429 return 1;
430 }
431
432 len = MultiByteToWideChar(CP_UTF8, 0, **argv, -1, NULL, 0);
433 *value = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
434 if (!*value)
435 {
436 fprintf(stderr, "error: memory allocation error\n");
437 (*argv)++;
438 return 1;
439 }
441 (*argv)++;
442 return 0;
443}
444
445static int parse_arguments(int argc, const char** argv)
446{
447 int rc;
448 const char* arg;
449 char* p;
450
451 rc=0;
452 argv++;
453 while (*argv)
454 {
455 arg=*argv++;
456 if (*arg!='-')
457 {
459 {
460 fprintf(stderr, "error: '%s' an action has already been specified\n", arg);
461 rc=1;
462 }
463 else if (strcmp(arg, "click") == 0 || strcmp(arg, "lclick") == 0)
464 {
466 }
467 else if (strcmp(arg, "mclick") == 0)
468 {
470 }
471 else if (strcmp(arg, "rclick") == 0)
472 {
474 }
475 else if (strncmp(arg, "button", 6) == 0)
476 {
477 int button;
478 char extra='\0';
479 int r=sscanf(arg, "button%d%c", &button, &extra);
480 /* We should always get r==1 but due to a bug in Wine's
481 * msvcrt.dll implementation (at least up to 20050127)
482 * we may also get r==2 and extra=='\0'.
483 */
484 if (r!=1 && (r!=2 || extra!='\0'))
485 {
486 fprintf(stderr, "error: invalid argument '%s' for '%s'\n",
487 *argv, arg);
488 rc=1;
489 }
490 else if (button<1 || button>3)
491 {
492 fprintf(stderr, "error: unknown button '%s'\n", arg);
493 rc=1;
494 }
495 else
496 {
497 /* Just to remain compatible with the enum */
499 }
500 }
501 else if (strcmp(arg, "find") == 0)
502 {
504 }
505 else
506 {
507 fprintf(stderr, "error: unknown action '%s'\n", arg);
508 rc=1;
509 }
510 }
511 else if (strcmp(arg, "--winclass") == 0)
512 {
514 }
515 else if (strcmp(arg, "--wintitle") == 0)
516 {
518 }
519 else if (strcmp(arg, "--ctrlclass") == 0)
520 {
522 }
523 else if (strcmp(arg, "--ctrlid") == 0)
524 {
526 }
527 else if (strcmp(arg, "--ctrlcaption") == 0)
528 {
530 }
531 else if (strcmp(arg, "--position") == 0)
532 {
533 if (!*argv)
534 {
535 fprintf(stderr, "error: missing argument for '%s'\n", arg);
536 rc=1;
537 }
538 else
539 {
540 char extra='\0';
541 int r=sscanf(*argv, "%ldx%ld%c", &g_x, &g_y, &extra);
542 /* We should always get r==2 but due to a bug in Wine's
543 * msvcrt.dll implementation (at least up to 20050127)
544 * we may also get r==3 and extra=='\0'.
545 */
546 if (r!=2 && (r!=3 || extra!='\0'))
547 {
548 fprintf(stderr, "error: invalid argument '%s' for '%s'\n",
549 *argv, arg);
550 rc=1;
551 }
552 argv++;
553 }
554 }
555 else if (strcmp(arg, "--dragto") == 0)
556 {
557 if (!*argv)
558 {
559 fprintf(stderr, "error: missing argument for '%s'\n", arg);
560 rc=1;
561 }
562 else
563 {
564 char extra='\0';
565 int r=sscanf(*argv, "%ldx%ld%c", &g_dragto_x, &g_dragto_y, &extra);
566 /* We should always get r==2 but due to a bug in Wine's
567 * * msvcrt.dll implementation (at least up to 20050127)
568 * * we may also get r==3 and extra=='\0'.
569 * */
570 if (r!=2 && (r!=3 || extra!='\0'))
571 {
572 fprintf(stderr, "error: invalid argument '%s' for '%s'\n",
573 *argv, arg);
574 rc=1;
575 }
576 argv++;
577 }
578 }
579 else if (strcmp(arg, "--allow-disabled") == 0)
580 {
581 g_disabled = 1;
582 }
583 else if (strcmp(arg, "--delay") == 0)
584 {
585 rc|=arg_get_long(&argv, arg, &g_delay);
586 }
587 else if (strcmp(arg, "--timeout") == 0)
588 {
590 }
591 else if (strcmp(arg, "--repeat") == 0)
592 {
593 rc|=arg_get_long(&argv, arg, &g_repeat);
594 }
595 else if (strcmp(arg, "--untildeath") == 0)
596 {
597 g_untildeath=1;
598 }
599 else if (strcmp(arg, "--help") == 0)
600 {
601 rc=2;
602 }
603 }
604
606 {
607 fprintf(stderr, "error: you must specify an action type\n");
608 rc=1;
609 }
610 else
611 {
612 /* Adjust the default delay and repeat parameters depending on
613 * the operating mode so less needs to be specified on the command
614 * line, and so we can assume them to be set right.
615 */
616 if (g_action == ACTION_FIND)
617 g_delay=0;
618 if (!g_untildeath)
619 g_repeat=0;
620 else if (!g_repeat)
622 }
623
624 if (!g_window_class)
625 {
626 fprintf(stderr, "error: you must specify a --winclass parameter\n");
627 rc=1;
628 }
629 if (!g_window_title)
630 {
631 fprintf(stderr, "error: you must specify a --wintitle parameter\n");
632 rc=1;
633 }
634 if (g_control_class)
635 {
637 {
638 fprintf(stderr, "error: you must specify either the control id or its caption\n");
639 rc=1;
640 }
641 }
642
643 /*------------------------------------------------------------------------
644 ** Process environment variables
645 **----------------------------------------------------------------------*/
646 p = getenv("CXTEST_TIME_MULTIPLE");
647 if (p)
648 {
649 float g_multiple = atof(p);
650 g_delay = (long) (((float) g_delay) * g_multiple);
651 g_timeout = (long) (((float) g_timeout) * g_multiple);
652 }
653
654 return rc;
655}
656
657int main(int argc, const char** argv)
658{
659 MSG msg;
660
661 init_debug();
662
664 if (status)
665 {
666 if (status == 2)
667 usage();
668 else
669 fprintf(stderr, "Issue %s --help for usage.\n", *argv);
671 }
672 cxlog("Entering message loop. action=%d\n", g_action);
673
674 if (g_timeout>0)
677
679 while (status==RC_RUNNING && GetMessage(&msg, NULL, 0, 0)!=0)
680 {
683 }
684
685 return status;
686}
static int argc
Definition: ServiceArgs.c:12
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
Arabic default style
Definition: afstyles.h:94
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define CALLBACK
Definition: compat.h:35
#define MultiByteToWideChar
Definition: compat.h:110
int main()
Definition: test.c:6
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
const GLint * first
Definition: glext.h:5794
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define up(mutex)
Definition: glue.h:30
#define down(mutex)
Definition: glue.h:29
@ extra
Definition: id3.c:95
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
_Check_return_ long __cdecl atol(_In_z_ const char *_Str)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
DWORD button
Definition: button.c:166
static IHTMLWindow2 * window
Definition: events.c:77
static __ms_va_list valist
Definition: printf.c:66
static const char haystack[]
Definition: editor.c:145
#define argv
Definition: mplay32.c:18
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_DISABLED
Definition: pedump.c:621
#define long
Definition: qsort.c:33
const WCHAR * str
#define CP_UTF8
Definition: nls.h:20
DWORD dwTime
Definition: solitaire.cpp:27
Definition: name.c:39
Definition: ps.c:97
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD cbSize
Definition: winuser.h:3766
RECT rcWindow
Definition: winuser.h:3767
double atof()
#define towlower(c)
Definition: wctype.h:97
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
Definition: pdh_main.c:94
static long g_untildeath
Definition: wclickat.c:78
static int arg_get_utf8(const char ***argv, const char *name, WCHAR **value)
Definition: wclickat.c:422
static int debug_on
Definition: wclickat.c:90
static long g_control_id
Definition: wclickat.c:66
static int init_debug()
Definition: wclickat.c:91
static void CALLBACK ClickProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: wclickat.c:317
static long g_dragto_x
Definition: wclickat.c:71
#define DEFAULT_REPEAT
Definition: wclickat.c:37
static void cxlog(const char *format,...) __PRINTF_ATTR(1
Definition: wclickat.c:100
static void CALLBACK DelayProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: wclickat.c:361
#define DEFAULT_DELAY
Definition: wclickat.c:36
static long g_delay
Definition: wclickat.c:75
static HWND find_window()
Definition: wclickat.c:251
static int arg_get_long(const char ***argv, const char *name, long *value)
Definition: wclickat.c:402
static long g_timeout
Definition: wclickat.c:76
static WCHAR * g_window_title
Definition: wclickat.c:65
static long g_dragto_y
Definition: wclickat.c:72
static void CALLBACK FindWindowProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: wclickat.c:374
static int status
Definition: wclickat.c:52
#define ARRAY_LENGTH(array)
Definition: wclickat.c:39
static long g_y
Definition: wclickat.c:70
static UINT timer_id
Definition: wclickat.c:79
#define RC_SUCCESS
Definition: wclickat.c:48
action_type
Definition: wclickat.c:55
@ ACTION_MCLICK
Definition: wclickat.c:59
@ ACTION_INVALID
Definition: wclickat.c:56
@ ACTION_FIND
Definition: wclickat.c:57
@ ACTION_RCLICK
Definition: wclickat.c:60
@ ACTION_LCLICK
Definition: wclickat.c:58
static const WCHAR * my_strstriW(const WCHAR *haystack, const WCHAR *needle)
Definition: wclickat.c:152
static action_type g_action
Definition: wclickat.c:62
#define __PRINTF_ATTR(fmt, args)
Definition: wclickat.c:88
static void do_click(HWND window, DWORD down, DWORD up)
Definition: wclickat.c:260
static BOOL CALLBACK find_top_window(HWND hwnd, LPARAM lParam)
Definition: wclickat.c:215
#define RC_TIMEOUT
Definition: wclickat.c:51
static long g_disabled
Definition: wclickat.c:73
static WCHAR * g_window_class
Definition: wclickat.c:64
static WCHAR * g_control_class
Definition: wclickat.c:67
static void usage(void)
Definition: wclickat.c:115
static WCHAR * g_control_caption
Definition: wclickat.c:68
#define RC_RUNNING
Definition: wclickat.c:47
static long g_x
Definition: wclickat.c:69
static void CALLBACK TimeoutProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: wclickat.c:394
static int parse_arguments(int argc, const char **argv)
Definition: wclickat.c:445
static BOOL CALLBACK find_control(HWND hwnd, LPARAM lParam)
Definition: wclickat.c:184
#define APP_NAME
Definition: wclickat.c:35
static const WCHAR STATIC_CLASS[]
Definition: wclickat.c:41
#define RC_INVALID_ARGUMENTS
Definition: wclickat.c:49
static long g_repeat
Definition: wclickat.c:77
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
void * arg
Definition: msvc.h:10
#define GetWindowStyle(hwnd)
Definition: windowsx.h:315
#define MOUSEEVENTF_ABSOLUTE
Definition: winuser.h:1194
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define SM_CYSCREEN
Definition: winuser.h:960
#define MOUSEEVENTF_LEFTUP
Definition: winuser.h:1185
#define GWL_ID
Definition: winuser.h:859
BOOL WINAPI GetWindowInfo(_In_ HWND, _Inout_ PWINDOWINFO)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define MOUSEEVENTF_RIGHTUP
Definition: winuser.h:1187
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define MOUSEEVENTF_MIDDLEUP
Definition: winuser.h:1189
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define MOUSEEVENTF_MOVE
Definition: winuser.h:1183
#define GetMessage
Definition: winuser.h:5790
#define MOUSEEVENTF_LEFTDOWN
Definition: winuser.h:1184
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
#define GetWindowLong
Definition: winuser.h:5796
HWND WINAPI GetParent(_In_ HWND)
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
#define MOUSEEVENTF_RIGHTDOWN
Definition: winuser.h:1186
#define SM_CXSCREEN
Definition: winuser.h:959
#define DispatchMessage
Definition: winuser.h:5765
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define MOUSEEVENTF_MIDDLEDOWN
Definition: winuser.h:1188
int WINAPI GetSystemMetrics(_In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define const
Definition: zconf.h:233