Window activation cleanups.
[wine] / windows / message.c
1 /*
2  * Message queues related functions
3  *
4  * Copyright 1993, 1994 Alexandre Julliard
5  */
6
7 #include <stdlib.h>
8 #include <string.h>
9 #include <ctype.h>
10 #include <sys/time.h>
11 #include <sys/types.h>
12
13 #include "winbase.h"
14 #include "wingdi.h"
15 #include "winuser.h"
16 #include "message.h"
17 #include "winerror.h"
18 #include "wine/server.h"
19 #include "win.h"
20 #include "heap.h"
21 #include "hook.h"
22 #include "input.h"
23 #include "spy.h"
24 #include "winpos.h"
25 #include "dde.h"
26 #include "queue.h"
27 #include "winproc.h"
28 #include "user.h"
29 #include "thread.h"
30 #include "task.h"
31 #include "controls.h"
32 #include "debugtools.h"
33
34 DEFAULT_DEBUG_CHANNEL(msg);
35 DECLARE_DEBUG_CHANNEL(key);
36
37 #define WM_NCMOUSEFIRST         WM_NCMOUSEMOVE
38 #define WM_NCMOUSELAST          WM_NCMBUTTONDBLCLK
39
40 static BYTE QueueKeyStateTable[256];
41 static UINT doubleClickSpeed = 452;
42
43
44 /***********************************************************************
45  *           is_keyboard_message
46  */
47 inline static BOOL is_keyboard_message( UINT message )
48 {
49     return (message >= WM_KEYFIRST && message <= WM_KEYLAST);
50 }
51
52
53 /***********************************************************************
54  *           is_mouse_message
55  */
56 inline static BOOL is_mouse_message( UINT message )
57 {
58     return ((message >= WM_NCMOUSEFIRST && message <= WM_NCMOUSELAST) ||
59             (message >= WM_MOUSEFIRST && message <= WM_MOUSELAST));
60 }
61
62
63 /***********************************************************************
64  *           check_message_filter
65  */
66 inline static BOOL check_message_filter( const MSG *msg, HWND hwnd, UINT first, UINT last )
67 {
68     if (hwnd)
69     {
70         if (msg->hwnd != hwnd && !IsChild( hwnd, msg->hwnd )) return FALSE;
71     }
72     if (first || last)
73     {
74        return (msg->message >= first && msg->message <= last);
75     }
76     return TRUE;
77 }
78
79
80 /***********************************************************************
81  *           process_sent_messages
82  *
83  * Process all pending sent messages.
84  */
85 inline static void process_sent_messages(void)
86 {
87     MSG msg;
88     MSG_peek_message( &msg, 0, 0, 0, GET_MSG_REMOVE | GET_MSG_SENT_ONLY );
89 }
90
91
92 /***********************************************************************
93  *           queue_hardware_message
94  *
95  * store a hardware message in the thread queue
96  */
97 static void queue_hardware_message( MSG *msg, ULONG_PTR extra_info, enum message_type type )
98 {
99     SERVER_START_REQ( send_message )
100     {
101         req->type   = type;
102         req->id     = (void *)GetWindowThreadProcessId( msg->hwnd, NULL );
103         req->win    = msg->hwnd;
104         req->msg    = msg->message;
105         req->wparam = msg->wParam;
106         req->lparam = msg->lParam;
107         req->x      = msg->pt.x;
108         req->y      = msg->pt.y;
109         req->time   = msg->time;
110         req->info   = extra_info;
111         req->timeout = 0;
112         SERVER_CALL();
113     }
114     SERVER_END_REQ;
115 }
116
117
118 /***********************************************************************
119  *           update_queue_key_state
120  */
121 static void update_queue_key_state( UINT msg, WPARAM wp )
122 {
123     BOOL down = FALSE;
124
125     switch (msg)
126     {
127     case WM_LBUTTONDOWN:
128         down = TRUE;
129         /* fall through */
130     case WM_LBUTTONUP:
131         wp = VK_LBUTTON;
132         break;
133     case WM_MBUTTONDOWN:
134         down = TRUE;
135         /* fall through */
136     case WM_MBUTTONUP:
137         wp = VK_MBUTTON;
138         break;
139     case WM_RBUTTONDOWN:
140         down = TRUE;
141         /* fall through */
142     case WM_RBUTTONUP:
143         wp = VK_RBUTTON;
144         break;
145     case WM_KEYDOWN:
146     case WM_SYSKEYDOWN:
147         down = TRUE;
148         /* fall through */
149     case WM_KEYUP:
150     case WM_SYSKEYUP:
151         wp = wp & 0xff;
152         break;
153     }
154     if (down)
155     {
156         BYTE *p = &QueueKeyStateTable[wp];
157         if (!(*p & 0x80)) *p ^= 0x01;
158         *p |= 0x80;
159     }
160     else QueueKeyStateTable[wp] &= ~0x80;
161 }
162
163
164 /***********************************************************************
165  *           MSG_SendParentNotify
166  *
167  * Send a WM_PARENTNOTIFY to all ancestors of the given window, unless
168  * the window has the WS_EX_NOPARENTNOTIFY style.
169  */
170 static void MSG_SendParentNotify( HWND hwnd, WORD event, WORD idChild, POINT pt )
171 {
172     /* pt has to be in the client coordinates of the parent window */
173     MapWindowPoints( 0, hwnd, &pt, 1 );
174     for (;;)
175     {
176         HWND parent;
177
178         if (!(GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD)) break;
179         if (GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) break;
180         if (!(parent = GetParent(hwnd))) break;
181         MapWindowPoints( hwnd, parent, &pt, 1 );
182         hwnd = parent;
183         SendMessageA( hwnd, WM_PARENTNOTIFY,
184                       MAKEWPARAM( event, idChild ), MAKELPARAM( pt.x, pt.y ) );
185     }
186 }
187
188
189 /***********************************************************************
190  *          MSG_JournalPlayBackMsg
191  *
192  * Get an EVENTMSG struct via call JOURNALPLAYBACK hook function 
193  */
194 void MSG_JournalPlayBackMsg(void)
195 {
196     EVENTMSG tmpMsg;
197     MSG msg;
198     LRESULT wtime;
199     int keyDown,i;
200
201     if (!HOOK_IsHooked( WH_JOURNALPLAYBACK )) return;
202
203     wtime=HOOK_CallHooksA( WH_JOURNALPLAYBACK, HC_GETNEXT, 0, (LPARAM)&tmpMsg );
204     /*  TRACE(msg,"Playback wait time =%ld\n",wtime); */
205     if (wtime<=0)
206     {
207         wtime=0;
208         msg.message = tmpMsg.message;
209         msg.hwnd    = tmpMsg.hwnd;
210         msg.time    = tmpMsg.time;
211         if ((tmpMsg.message >= WM_KEYFIRST) && (tmpMsg.message <= WM_KEYLAST))
212         {
213             msg.wParam  = tmpMsg.paramL & 0xFF;
214             msg.lParam  = MAKELONG(tmpMsg.paramH&0x7ffff,tmpMsg.paramL>>8);
215             if (tmpMsg.message == WM_KEYDOWN || tmpMsg.message == WM_SYSKEYDOWN)
216             {
217                 for (keyDown=i=0; i<256 && !keyDown; i++)
218                     if (InputKeyStateTable[i] & 0x80)
219                         keyDown++;
220                 if (!keyDown)
221                     msg.lParam |= 0x40000000;
222                 InputKeyStateTable[msg.wParam] |= 0x80;
223                 AsyncKeyStateTable[msg.wParam] |= 0x80;
224             }
225             else                                       /* WM_KEYUP, WM_SYSKEYUP */
226             {
227                 msg.lParam |= 0xC0000000;
228                 InputKeyStateTable[msg.wParam] &= ~0x80;
229             }
230             if (InputKeyStateTable[VK_MENU] & 0x80)
231                 msg.lParam |= 0x20000000;
232             if (tmpMsg.paramH & 0x8000)              /*special_key bit*/
233                 msg.lParam |= 0x01000000;
234
235             msg.pt.x = msg.pt.y = 0;
236             queue_hardware_message( &msg, 0, MSG_HARDWARE_RAW );
237         }
238         else if ((tmpMsg.message>= WM_MOUSEFIRST) && (tmpMsg.message <= WM_MOUSELAST))
239         {
240             switch (tmpMsg.message)
241             {
242             case WM_LBUTTONDOWN:
243                 InputKeyStateTable[VK_LBUTTON] |= 0x80;
244                 AsyncKeyStateTable[VK_LBUTTON] |= 0x80;
245                 break;
246             case WM_LBUTTONUP:
247                 InputKeyStateTable[VK_LBUTTON] &= ~0x80;
248                 break;
249             case WM_MBUTTONDOWN:
250                 InputKeyStateTable[VK_MBUTTON] |= 0x80;
251                 AsyncKeyStateTable[VK_MBUTTON] |= 0x80;
252                 break;
253             case WM_MBUTTONUP:
254                 InputKeyStateTable[VK_MBUTTON] &= ~0x80;
255                 break;
256             case WM_RBUTTONDOWN:
257                 InputKeyStateTable[VK_RBUTTON] |= 0x80;
258                 AsyncKeyStateTable[VK_RBUTTON] |= 0x80;
259                 break;
260             case WM_RBUTTONUP:
261                 InputKeyStateTable[VK_RBUTTON] &= ~0x80;
262                 break;
263             }
264             SetCursorPos(tmpMsg.paramL,tmpMsg.paramH);
265             msg.lParam=MAKELONG(tmpMsg.paramL,tmpMsg.paramH);
266             msg.wParam=0;
267             if (InputKeyStateTable[VK_LBUTTON] & 0x80) msg.wParam |= MK_LBUTTON;
268             if (InputKeyStateTable[VK_MBUTTON] & 0x80) msg.wParam |= MK_MBUTTON;
269             if (InputKeyStateTable[VK_RBUTTON] & 0x80) msg.wParam |= MK_RBUTTON;
270
271             msg.pt.x = tmpMsg.paramL;
272             msg.pt.y = tmpMsg.paramH;
273             queue_hardware_message( &msg, 0, MSG_HARDWARE_RAW );
274         }
275         HOOK_CallHooksA( WH_JOURNALPLAYBACK, HC_SKIP, 0, (LPARAM)&tmpMsg);
276     }
277     else
278     {
279         if( tmpMsg.message == WM_QUEUESYNC )
280             if (HOOK_IsHooked( WH_CBT ))
281                 HOOK_CallHooksA( WH_CBT, HCBT_QS, 0, 0L);
282     }
283 }
284
285
286 /***********************************************************************
287  *          process_raw_keyboard_message
288  *
289  * returns TRUE if the contents of 'msg' should be passed to the application
290  */
291 static BOOL process_raw_keyboard_message( MSG *msg, ULONG_PTR extra_info )
292 {
293     if (!(msg->hwnd = GetFocus()))
294     {
295         /* Send the message to the active window instead,  */
296         /* translating messages to their WM_SYS equivalent */
297         msg->hwnd = GetActiveWindow();
298         if (msg->message < WM_SYSKEYDOWN) msg->message += WM_SYSKEYDOWN - WM_KEYDOWN;
299     }
300
301     if (HOOK_IsHooked( WH_JOURNALRECORD ))
302     {
303         EVENTMSG event;
304
305         event.message = msg->message;
306         event.hwnd    = msg->hwnd;
307         event.time    = msg->time;
308         event.paramL  = (msg->wParam & 0xFF) | (HIWORD(msg->lParam) << 8);
309         event.paramH  = msg->lParam & 0x7FFF;
310         if (HIWORD(msg->lParam) & 0x0100) event.paramH |= 0x8000; /* special_key - bit */
311         HOOK_CallHooksA( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&event );
312     }
313
314     return (msg->hwnd != 0);
315 }
316
317
318 /***********************************************************************
319  *          process_cooked_keyboard_message
320  *
321  * returns TRUE if the contents of 'msg' should be passed to the application
322  */
323 static BOOL process_cooked_keyboard_message( MSG *msg, BOOL remove )
324 {
325     if (remove)
326     {
327         update_queue_key_state( msg->message, msg->wParam );
328
329         /* Handle F1 key by sending out WM_HELP message */
330         if ((msg->message == WM_KEYUP) &&
331             (msg->wParam == VK_F1) &&
332             (msg->hwnd != GetDesktopWindow()) &&
333             !MENU_IsMenuActive())
334         {
335             HELPINFO hi;
336             hi.cbSize = sizeof(HELPINFO);
337             hi.iContextType = HELPINFO_WINDOW;
338             hi.iCtrlId = GetWindowLongA( msg->hwnd, GWL_ID );
339             hi.hItemHandle = msg->hwnd;
340             hi.dwContextId = GetWindowContextHelpId( msg->hwnd );
341             hi.MousePos = msg->pt;
342             SendMessageA(msg->hwnd, WM_HELP, 0, (LPARAM)&hi);
343         }
344     }
345
346     if (HOOK_CallHooksA( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE,
347                          LOWORD(msg->wParam), msg->lParam ))
348     {
349         /* skip this message */
350         HOOK_CallHooksA( WH_CBT, HCBT_KEYSKIPPED, LOWORD(msg->wParam), msg->lParam );
351         return FALSE;
352     }
353     return TRUE;
354 }
355
356
357 /***********************************************************************
358  *          process_raw_mouse_message
359  *
360  * returns TRUE if the contents of 'msg' should be passed to the application
361  */
362 static BOOL process_raw_mouse_message( MSG *msg, ULONG_PTR extra_info )
363 {
364     static MSG clk_msg;
365
366     POINT pt;
367     INT ht, hittest;
368
369     /* find the window to dispatch this mouse message to */
370
371     hittest = HTCLIENT;
372     if (!(msg->hwnd = PERQDATA_GetCaptureWnd( &ht )))
373     {
374         /* If no capture HWND, find window which contains the mouse position.
375          * Also find the position of the cursor hot spot (hittest) */
376         HWND hWndScope = (HWND)extra_info;
377
378         if (!IsWindow(hWndScope)) hWndScope = 0;
379         if (!(msg->hwnd = WINPOS_WindowFromPoint( hWndScope, msg->pt, &hittest )))
380             msg->hwnd = GetDesktopWindow();
381         ht = hittest;
382     }
383
384     if (HOOK_IsHooked( WH_JOURNALRECORD ))
385     {
386         EVENTMSG event;
387         event.message = msg->message;
388         event.time    = msg->time;
389         event.hwnd    = msg->hwnd;
390         event.paramL  = msg->pt.x;
391         event.paramH  = msg->pt.y;
392         HOOK_CallHooksA( WH_JOURNALRECORD, HC_ACTION, 0, (LPARAM)&event );
393     }
394
395     /* translate double clicks */
396
397     if ((msg->message == WM_LBUTTONDOWN) ||
398         (msg->message == WM_RBUTTONDOWN) ||
399         (msg->message == WM_MBUTTONDOWN))
400     {
401         BOOL update = TRUE;
402         /* translate double clicks -
403          * note that ...MOUSEMOVEs can slip in between
404          * ...BUTTONDOWN and ...BUTTONDBLCLK messages */
405
406         if (GetClassLongA( msg->hwnd, GCL_STYLE ) & CS_DBLCLKS || ht != HTCLIENT )
407         {
408            if ((msg->message == clk_msg.message) &&
409                (msg->hwnd == clk_msg.hwnd) &&
410                (msg->time - clk_msg.time < doubleClickSpeed) &&
411                (abs(msg->pt.x - clk_msg.pt.x) < GetSystemMetrics(SM_CXDOUBLECLK)/2) &&
412                (abs(msg->pt.y - clk_msg.pt.y) < GetSystemMetrics(SM_CYDOUBLECLK)/2))
413            {
414                msg->message += (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN);
415                clk_msg.message = 0;
416                update = FALSE;
417            }
418         }
419         /* update static double click conditions */
420         if (update) clk_msg = *msg;
421     }
422
423     pt = msg->pt;
424     /* Note: windows has no concept of a non-client wheel message */
425     if (hittest != HTCLIENT && msg->message != WM_MOUSEWHEEL)
426     {
427         msg->message += WM_NCMOUSEMOVE - WM_MOUSEMOVE;
428         msg->wParam = hittest;
429     }
430     else ScreenToClient( msg->hwnd, &pt );
431     msg->lParam = MAKELONG( pt.x, pt.y );
432     return TRUE;
433 }
434
435
436 /***********************************************************************
437  *          process_cooked_mouse_message
438  *
439  * returns TRUE if the contents of 'msg' should be passed to the application
440  */
441 static BOOL process_cooked_mouse_message( MSG *msg, ULONG_PTR extra_info, BOOL remove )
442 {
443     INT hittest = HTCLIENT;
444     UINT raw_message = msg->message;
445     BOOL eatMsg;
446
447     if (msg->message >= WM_NCMOUSEFIRST && msg->message <= WM_NCMOUSELAST)
448     {
449         raw_message += WM_MOUSEFIRST - WM_NCMOUSEFIRST;
450         hittest = msg->wParam;
451     }
452     if (raw_message == WM_LBUTTONDBLCLK ||
453         raw_message == WM_RBUTTONDBLCLK ||
454         raw_message == WM_MBUTTONDBLCLK)
455     {
456         raw_message += WM_LBUTTONDOWN - WM_LBUTTONDBLCLK;
457     }
458
459     if (remove) update_queue_key_state( raw_message, 0 );
460
461     if (HOOK_IsHooked( WH_MOUSE ))
462     {
463         MOUSEHOOKSTRUCT hook;
464         hook.pt           = msg->pt;
465         hook.hwnd         = msg->hwnd;
466         hook.wHitTestCode = hittest;
467         hook.dwExtraInfo  = extra_info;
468         if (HOOK_CallHooksA( WH_MOUSE, remove ? HC_ACTION : HC_NOREMOVE,
469                              msg->message, (LPARAM)&hook ))
470         {
471             hook.pt           = msg->pt;
472             hook.hwnd         = msg->hwnd;
473             hook.wHitTestCode = hittest;
474             hook.dwExtraInfo  = extra_info;
475             HOOK_CallHooksA( WH_CBT, HCBT_CLICKSKIPPED, msg->message, (LPARAM)&hook );
476             return FALSE;
477         }
478     }
479
480     if ((hittest == HTERROR) || (hittest == HTNOWHERE))
481     {
482         SendMessageA( msg->hwnd, WM_SETCURSOR, msg->hwnd, MAKELONG( hittest, raw_message ));
483         return FALSE;
484     }
485
486     if (!remove || GetCapture()) return TRUE;
487
488     eatMsg = FALSE;
489
490     if ((raw_message == WM_LBUTTONDOWN) ||
491         (raw_message == WM_RBUTTONDOWN) ||
492         (raw_message == WM_MBUTTONDOWN))
493     {
494         HWND hwndTop = GetAncestor( msg->hwnd, GA_ROOT );
495
496         /* Send the WM_PARENTNOTIFY,
497          * note that even for double/nonclient clicks
498          * notification message is still WM_L/M/RBUTTONDOWN.
499          */
500         MSG_SendParentNotify( msg->hwnd, raw_message, 0, msg->pt );
501
502         /* Activate the window if needed */
503
504         if (msg->hwnd != GetActiveWindow() && hwndTop != GetDesktopWindow())
505         {
506             LONG ret = SendMessageA( msg->hwnd, WM_MOUSEACTIVATE, hwndTop,
507                                      MAKELONG( hittest, raw_message ) );
508
509             switch(ret)
510             {
511             case MA_NOACTIVATEANDEAT:
512                 eatMsg = TRUE;
513                 /* fall through */
514             case MA_NOACTIVATE:
515                 break;
516             case MA_ACTIVATEANDEAT:
517                 eatMsg = TRUE;
518                 /* fall through */
519             case MA_ACTIVATE:
520             case 0:
521                 if (hwndTop != GetForegroundWindow() )
522                 {
523                     if (!WINPOS_SetActiveWindow( hwndTop, TRUE , TRUE ))
524                         eatMsg = TRUE;
525                 }
526                 break;
527             default:
528                 WARN( "unknown WM_MOUSEACTIVATE code %ld\n", ret );
529                 break;
530             }
531         }
532     }
533
534     /* send the WM_SETCURSOR message */
535
536     /* Windows sends the normal mouse message as the message parameter
537        in the WM_SETCURSOR message even if it's non-client mouse message */
538     SendMessageA( msg->hwnd, WM_SETCURSOR, msg->hwnd, MAKELONG( hittest, raw_message ));
539
540     return !eatMsg;
541 }
542
543
544 /***********************************************************************
545  *          process_hardware_message
546  *
547  * returns TRUE if the contents of 'msg' should be passed to the application
548  */
549 BOOL MSG_process_raw_hardware_message( MSG *msg, ULONG_PTR extra_info, HWND hwnd_filter,
550                                        UINT first, UINT last, BOOL remove )
551 {
552     if (is_keyboard_message( msg->message ))
553     {
554         if (!process_raw_keyboard_message( msg, extra_info )) return FALSE;
555     }
556     else if (is_mouse_message( msg->message ))
557     {
558         if (!process_raw_mouse_message( msg, extra_info )) return FALSE;
559     }
560     else
561     {
562         ERR( "unknown message type %x\n", msg->message );
563         return FALSE;
564     }
565
566     /* check destination thread and filters */
567     if (!check_message_filter( msg, hwnd_filter, first, last ) ||
568         !WIN_IsCurrentThread( msg->hwnd ))
569     {
570         /* queue it for later, or for another thread */
571         queue_hardware_message( msg, extra_info, MSG_HARDWARE_COOKED );
572         return FALSE;
573     }
574
575     /* save the message in the cooked queue if we didn't want to remove it */
576     if (!remove) queue_hardware_message( msg, extra_info, MSG_HARDWARE_COOKED );
577     return TRUE;
578 }
579
580
581 /***********************************************************************
582  *          MSG_process_cooked_hardware_message
583  *
584  * returns TRUE if the contents of 'msg' should be passed to the application
585  */
586 BOOL MSG_process_cooked_hardware_message( MSG *msg, ULONG_PTR extra_info, BOOL remove )
587 {
588     if (is_keyboard_message( msg->message ))
589         return process_cooked_keyboard_message( msg, remove );
590
591     if (is_mouse_message( msg->message ))
592         return process_cooked_mouse_message( msg, extra_info, remove );
593
594     ERR( "unknown message type %x\n", msg->message );
595     return FALSE;
596 }
597
598
599 /**********************************************************************
600  *              GetKeyState (USER.106)
601  */
602 INT16 WINAPI GetKeyState16(INT16 vkey)
603 {
604     return GetKeyState(vkey);
605 }
606
607
608 /**********************************************************************
609  *              GetKeyState (USER32.@)
610  *
611  * An application calls the GetKeyState function in response to a
612  * keyboard-input message.  This function retrieves the state of the key
613  * at the time the input message was generated.  (SDK 3.1 Vol 2. p 390)
614  */
615 SHORT WINAPI GetKeyState(INT vkey)
616 {
617     INT retval;
618
619     if (vkey >= 'a' && vkey <= 'z') vkey += 'A' - 'a';
620     retval = ((WORD)(QueueKeyStateTable[vkey] & 0x80) << 8 ) | (QueueKeyStateTable[vkey] & 0x01);
621     /* TRACE(key, "(0x%x) -> %x\n", vkey, retval); */
622     return retval;
623 }
624
625
626 /**********************************************************************
627  *              GetKeyboardState (USER.222)
628  *              GetKeyboardState (USER32.@)
629  *
630  * An application calls the GetKeyboardState function in response to a
631  * keyboard-input message.  This function retrieves the state of the keyboard
632  * at the time the input message was generated.  (SDK 3.1 Vol 2. p 387)
633  */
634 BOOL WINAPI GetKeyboardState(LPBYTE lpKeyState)
635 {
636     TRACE_(key)("(%p)\n", lpKeyState);
637     if (lpKeyState) memcpy(lpKeyState, QueueKeyStateTable, 256);
638     return TRUE;
639 }
640
641
642 /**********************************************************************
643  *              SetKeyboardState (USER.223)
644  *              SetKeyboardState (USER32.@)
645  */
646 BOOL WINAPI SetKeyboardState(LPBYTE lpKeyState)
647 {
648     TRACE_(key)("(%p)\n", lpKeyState);
649     if (lpKeyState) memcpy(QueueKeyStateTable, lpKeyState, 256);
650     return TRUE;
651 }
652
653
654 /**********************************************************************
655  *              SetDoubleClickTime (USER32.@)
656  */
657 BOOL WINAPI SetDoubleClickTime( UINT interval )
658 {
659     doubleClickSpeed = interval ? interval : 500;
660     return TRUE;
661 }               
662
663
664 /**********************************************************************
665  *              GetDoubleClickTime (USER32.@)
666  */
667 UINT WINAPI GetDoubleClickTime(void)
668 {
669     return doubleClickSpeed;
670 }               
671
672
673 /***********************************************************************
674  *              WaitMessage (USER.112) Suspend thread pending messages
675  *              WaitMessage (USER32.@) Suspend thread pending messages
676  *
677  * WaitMessage() suspends a thread until events appear in the thread's
678  * queue.
679  */
680 BOOL WINAPI WaitMessage(void)
681 {
682     return (MsgWaitForMultipleObjectsEx( 0, NULL, INFINITE, QS_ALLINPUT, 0 ) != WAIT_FAILED);
683 }
684
685
686 /***********************************************************************
687  *              MsgWaitForMultipleObjectsEx   (USER32.@)
688  */
689 DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles,
690                                           DWORD timeout, DWORD mask, DWORD flags )
691 {
692     HANDLE handles[MAXIMUM_WAIT_OBJECTS];
693     DWORD i, ret;
694     MESSAGEQUEUE *msgQueue;
695
696     if (count > MAXIMUM_WAIT_OBJECTS-1)
697     {
698         SetLastError( ERROR_INVALID_PARAMETER );
699         return WAIT_FAILED;
700     }
701
702     if (!(msgQueue = QUEUE_Current())) return WAIT_FAILED;
703
704     /* set the queue mask */
705     SERVER_START_REQ( set_queue_mask )
706     {
707         req->wake_mask    = (flags & MWMO_INPUTAVAILABLE) ? mask : 0;
708         req->changed_mask = mask;
709         req->skip_wait    = 0;
710         SERVER_CALL();
711     }
712     SERVER_END_REQ;
713
714     /* Add the thread event to the handle list */
715     for (i = 0; i < count; i++) handles[i] = pHandles[i];
716     handles[count] = msgQueue->server_queue;
717
718
719     if (USER_Driver.pMsgWaitForMultipleObjectsEx)
720     {
721         ret = USER_Driver.pMsgWaitForMultipleObjectsEx( count+1, handles, timeout, mask, flags );
722         if (ret == count+1) ret = count; /* pretend the msg queue is ready */
723     }
724     else
725         ret = WaitForMultipleObjectsEx( count+1, handles, flags & MWMO_WAITALL,
726                                         timeout, flags & MWMO_ALERTABLE );
727     return ret;
728 }
729
730
731 /***********************************************************************
732  *              MsgWaitForMultipleObjects (USER32.@)
733  */
734 DWORD WINAPI MsgWaitForMultipleObjects( DWORD count, CONST HANDLE *handles,
735                                         BOOL wait_all, DWORD timeout, DWORD mask )
736 {
737     return MsgWaitForMultipleObjectsEx( count, handles, timeout, mask,
738                                         wait_all ? MWMO_WAITALL : 0 );
739 }
740
741
742 /***********************************************************************
743  *              WaitForInputIdle (USER32.@)
744  */
745 DWORD WINAPI WaitForInputIdle( HANDLE hProcess, DWORD dwTimeOut )
746 {
747     DWORD start_time, elapsed, ret;
748     HANDLE idle_event = -1;
749
750     SERVER_START_REQ( wait_input_idle )
751     {
752         req->handle = hProcess;
753         req->timeout = dwTimeOut;
754         if (!(ret = SERVER_CALL_ERR())) idle_event = req->event;
755     }
756     SERVER_END_REQ;
757     if (ret) return WAIT_FAILED;  /* error */
758     if (!idle_event) return 0;  /* no event to wait on */
759
760     start_time = GetTickCount();
761     elapsed = 0;
762
763     TRACE("waiting for %x\n", idle_event );
764     do
765     {
766         ret = MsgWaitForMultipleObjects ( 1, &idle_event, FALSE, dwTimeOut - elapsed, QS_SENDMESSAGE );
767         switch (ret)
768         {
769         case WAIT_OBJECT_0+1:
770             process_sent_messages();
771             break;
772         case WAIT_TIMEOUT:
773         case WAIT_FAILED:
774             TRACE("timeout or error\n");
775             return ret;
776         default:
777             TRACE("finished\n");
778             return 0;
779         }
780         if (dwTimeOut != INFINITE)
781         {
782             elapsed = GetTickCount() - start_time;
783             if (elapsed > dwTimeOut)
784                 break;
785         }
786     }
787     while (1);
788
789     return WAIT_TIMEOUT;
790 }
791
792
793 /***********************************************************************
794  *              UserYield (USER.332)
795  *              UserYield16 (USER32.@)
796  */
797 void WINAPI UserYield16(void)
798 {
799    DWORD count;
800
801     /* Handle sent messages */
802     process_sent_messages();
803
804     /* Yield */
805     ReleaseThunkLock(&count);
806     if (count)
807     {
808         RestoreThunkLock(count);
809         /* Handle sent messages again */
810         process_sent_messages();
811     }
812 }
813
814
815 struct accent_char
816 {
817     BYTE ac_accent;
818     BYTE ac_char;
819     BYTE ac_result;
820 };
821
822 static const struct accent_char accent_chars[] =
823 {
824 /* A good idea should be to read /usr/X11/lib/X11/locale/iso8859-x/Compose */
825     {'`', 'A', '\300'},  {'`', 'a', '\340'},
826     {'\'', 'A', '\301'}, {'\'', 'a', '\341'},
827     {'^', 'A', '\302'},  {'^', 'a', '\342'},
828     {'~', 'A', '\303'},  {'~', 'a', '\343'},
829     {'"', 'A', '\304'},  {'"', 'a', '\344'},
830     {'O', 'A', '\305'},  {'o', 'a', '\345'},
831     {'0', 'A', '\305'},  {'0', 'a', '\345'},
832     {'A', 'A', '\305'},  {'a', 'a', '\345'},
833     {'A', 'E', '\306'},  {'a', 'e', '\346'},
834     {',', 'C', '\307'},  {',', 'c', '\347'},
835     {'`', 'E', '\310'},  {'`', 'e', '\350'},
836     {'\'', 'E', '\311'}, {'\'', 'e', '\351'},
837     {'^', 'E', '\312'},  {'^', 'e', '\352'},
838     {'"', 'E', '\313'},  {'"', 'e', '\353'},
839     {'`', 'I', '\314'},  {'`', 'i', '\354'},
840     {'\'', 'I', '\315'}, {'\'', 'i', '\355'},
841     {'^', 'I', '\316'},  {'^', 'i', '\356'},
842     {'"', 'I', '\317'},  {'"', 'i', '\357'},
843     {'-', 'D', '\320'},  {'-', 'd', '\360'},
844     {'~', 'N', '\321'},  {'~', 'n', '\361'},
845     {'`', 'O', '\322'},  {'`', 'o', '\362'},
846     {'\'', 'O', '\323'}, {'\'', 'o', '\363'},
847     {'^', 'O', '\324'},  {'^', 'o', '\364'},
848     {'~', 'O', '\325'},  {'~', 'o', '\365'},
849     {'"', 'O', '\326'},  {'"', 'o', '\366'},
850     {'/', 'O', '\330'},  {'/', 'o', '\370'},
851     {'`', 'U', '\331'},  {'`', 'u', '\371'},
852     {'\'', 'U', '\332'}, {'\'', 'u', '\372'},
853     {'^', 'U', '\333'},  {'^', 'u', '\373'},
854     {'"', 'U', '\334'},  {'"', 'u', '\374'},
855     {'\'', 'Y', '\335'}, {'\'', 'y', '\375'},
856     {'T', 'H', '\336'},  {'t', 'h', '\376'},
857     {'s', 's', '\337'},  {'"', 'y', '\377'},
858     {'s', 'z', '\337'},  {'i', 'j', '\377'},
859         /* iso-8859-2 uses this */
860     {'<', 'L', '\245'},  {'<', 'l', '\265'},    /* caron */
861     {'<', 'S', '\251'},  {'<', 's', '\271'},
862     {'<', 'T', '\253'},  {'<', 't', '\273'},
863     {'<', 'Z', '\256'},  {'<', 'z', '\276'},
864     {'<', 'C', '\310'},  {'<', 'c', '\350'},
865     {'<', 'E', '\314'},  {'<', 'e', '\354'},
866     {'<', 'D', '\317'},  {'<', 'd', '\357'},
867     {'<', 'N', '\322'},  {'<', 'n', '\362'},
868     {'<', 'R', '\330'},  {'<', 'r', '\370'},
869     {';', 'A', '\241'},  {';', 'a', '\261'},    /* ogonek */
870     {';', 'E', '\312'},  {';', 'e', '\332'},
871     {'\'', 'Z', '\254'}, {'\'', 'z', '\274'},   /* acute */
872     {'\'', 'R', '\300'}, {'\'', 'r', '\340'},
873     {'\'', 'L', '\305'}, {'\'', 'l', '\345'},
874     {'\'', 'C', '\306'}, {'\'', 'c', '\346'},
875     {'\'', 'N', '\321'}, {'\'', 'n', '\361'},
876 /*  collision whith S, from iso-8859-9 !!! */
877     {',', 'S', '\252'},  {',', 's', '\272'},    /* cedilla */
878     {',', 'T', '\336'},  {',', 't', '\376'},
879     {'.', 'Z', '\257'},  {'.', 'z', '\277'},    /* dot above */
880     {'/', 'L', '\243'},  {'/', 'l', '\263'},    /* slash */
881     {'/', 'D', '\320'},  {'/', 'd', '\360'},
882     {'(', 'A', '\303'},  {'(', 'a', '\343'},    /* breve */
883     {'\275', 'O', '\325'}, {'\275', 'o', '\365'},       /* double acute */
884     {'\275', 'U', '\334'}, {'\275', 'u', '\374'},
885     {'0', 'U', '\332'},  {'0', 'u', '\372'},    /* ring above */
886         /* iso-8859-3 uses this */
887     {'/', 'H', '\241'},  {'/', 'h', '\261'},    /* slash */
888     {'>', 'H', '\246'},  {'>', 'h', '\266'},    /* circumflex */
889     {'>', 'J', '\254'},  {'>', 'j', '\274'},
890     {'>', 'C', '\306'},  {'>', 'c', '\346'},
891     {'>', 'G', '\330'},  {'>', 'g', '\370'},
892     {'>', 'S', '\336'},  {'>', 's', '\376'},
893 /*  collision whith G( from iso-8859-9 !!!   */
894     {'(', 'G', '\253'},  {'(', 'g', '\273'},    /* breve */
895     {'(', 'U', '\335'},  {'(', 'u', '\375'},
896 /*  collision whith I. from iso-8859-3 !!!   */
897     {'.', 'I', '\251'},  {'.', 'i', '\271'},    /* dot above */
898     {'.', 'C', '\305'},  {'.', 'c', '\345'},
899     {'.', 'G', '\325'},  {'.', 'g', '\365'},
900         /* iso-8859-4 uses this */
901     {',', 'R', '\243'},  {',', 'r', '\263'},    /* cedilla */
902     {',', 'L', '\246'},  {',', 'l', '\266'},
903     {',', 'G', '\253'},  {',', 'g', '\273'},
904     {',', 'N', '\321'},  {',', 'n', '\361'},
905     {',', 'K', '\323'},  {',', 'k', '\363'},
906     {'~', 'I', '\245'},  {'~', 'i', '\265'},    /* tilde */
907     {'-', 'E', '\252'},  {'-', 'e', '\272'},    /* macron */
908     {'-', 'A', '\300'},  {'-', 'a', '\340'},
909     {'-', 'I', '\317'},  {'-', 'i', '\357'},
910     {'-', 'O', '\322'},  {'-', 'o', '\362'},
911     {'-', 'U', '\336'},  {'-', 'u', '\376'},
912     {'/', 'T', '\254'},  {'/', 't', '\274'},    /* slash */
913     {'.', 'E', '\314'},  {'.', 'e', '\344'},    /* dot above */
914     {';', 'I', '\307'},  {';', 'i', '\347'},    /* ogonek */
915     {';', 'U', '\331'},  {';', 'u', '\371'},
916         /* iso-8859-9 uses this */
917         /* iso-8859-9 has really bad choosen G( S, and I. as they collide
918          * whith the same letters on other iso-8859-x (that is they are on
919          * different places :-( ), if you use turkish uncomment these and
920          * comment out the lines in iso-8859-2 and iso-8859-3 sections
921          * FIXME: should be dynamic according to chosen language
922          *        if/when Wine has turkish support.  
923          */ 
924 /*  collision whith G( from iso-8859-3 !!!   */
925 /*  {'(', 'G', '\320'},  {'(', 'g', '\360'}, */ /* breve */
926 /*  collision whith S, from iso-8859-2 !!! */
927 /*  {',', 'S', '\336'},  {',', 's', '\376'}, */ /* cedilla */
928 /*  collision whith I. from iso-8859-3 !!!   */
929 /*  {'.', 'I', '\335'},  {'.', 'i', '\375'}, */ /* dot above */
930 };
931
932
933 /***********************************************************************
934  *              TranslateMessage (USER32.@)
935  *
936  * Implementation of TranslateMessage.
937  *
938  * TranslateMessage translates virtual-key messages into character-messages,
939  * as follows :
940  * WM_KEYDOWN/WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message.
941  * ditto replacing WM_* with WM_SYS*
942  * This produces WM_CHAR messages only for keys mapped to ASCII characters
943  * by the keyboard driver.
944  */
945 BOOL WINAPI TranslateMessage( const MSG *msg )
946 {
947     static int dead_char;
948     UINT message;
949     WCHAR wp[2];
950
951     if (msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST)
952         TRACE_(key)("(%s, %04X, %08lX)\n",
953                     SPY_GetMsgName(msg->message, msg->hwnd), msg->wParam, msg->lParam );
954
955     if ((msg->message != WM_KEYDOWN) && (msg->message != WM_SYSKEYDOWN)) return FALSE;
956
957     TRACE_(key)("Translating key %s (%04x), scancode %02x\n",
958                  SPY_GetVKeyName(msg->wParam), msg->wParam, LOBYTE(HIWORD(msg->lParam)));
959
960     /* FIXME : should handle ToUnicode yielding 2 */
961     switch (ToUnicode(msg->wParam, HIWORD(msg->lParam), QueueKeyStateTable, wp, 2, 0))
962     {
963     case 1:
964         message = (msg->message == WM_KEYDOWN) ? WM_CHAR : WM_SYSCHAR;
965         /* Should dead chars handling go in ToAscii ? */
966         if (dead_char)
967         {
968             int i;
969
970             if (wp[0] == ' ') wp[0] =  dead_char;
971             if (dead_char == 0xa2) dead_char = '(';
972             else if (dead_char == 0xa8) dead_char = '"';
973             else if (dead_char == 0xb2) dead_char = ';';
974             else if (dead_char == 0xb4) dead_char = '\'';
975             else if (dead_char == 0xb7) dead_char = '<';
976             else if (dead_char == 0xb8) dead_char = ',';
977             else if (dead_char == 0xff) dead_char = '.';
978             for (i = 0; i < sizeof(accent_chars)/sizeof(accent_chars[0]); i++)
979                 if ((accent_chars[i].ac_accent == dead_char) &&
980                     (accent_chars[i].ac_char == wp[0]))
981                 {
982                     wp[0] = accent_chars[i].ac_result;
983                     break;
984                 }
985             dead_char = 0;
986         }
987         TRACE_(key)("1 -> PostMessage(%s)\n", SPY_GetMsgName(message, msg->hwnd));
988         PostMessageW( msg->hwnd, message, wp[0], msg->lParam );
989         return TRUE;
990
991     case -1:
992         message = (msg->message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR;
993         dead_char = wp[0];
994         TRACE_(key)("-1 -> PostMessage(%s)\n", SPY_GetMsgName(message, msg->hwnd));
995         PostMessageW( msg->hwnd, message, wp[0], msg->lParam );
996         return TRUE;
997     }
998     return FALSE;
999 }
1000
1001
1002 /***********************************************************************
1003  *              DispatchMessageA (USER32.@)
1004  */
1005 LONG WINAPI DispatchMessageA( const MSG* msg )
1006 {
1007     WND * wndPtr;
1008     LONG retval;
1009     int painting;
1010     WNDPROC winproc;
1011
1012       /* Process timer messages */
1013     if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
1014     {
1015         if (msg->lParam)
1016         {
1017 /*            HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
1018
1019             /* before calling window proc, verify whether timer is still valid;
1020                there's a slim chance that the application kills the timer
1021                between GetMessage and DispatchMessage API calls */
1022             if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, (HWINDOWPROC) msg->lParam))
1023                 return 0; /* invalid winproc */
1024
1025             return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd,
1026                                    msg->message, msg->wParam, GetTickCount() );
1027         }
1028     }
1029
1030     if (!(wndPtr = WIN_GetPtr( msg->hwnd )))
1031     {
1032         if (msg->hwnd) SetLastError( ERROR_INVALID_WINDOW_HANDLE );
1033         return 0;
1034     }
1035     if (wndPtr == WND_OTHER_PROCESS)
1036     {
1037         if (IsWindow( msg->hwnd ))
1038             ERR( "cannot dispatch msg to other process window %x\n", msg->hwnd );
1039         SetLastError( ERROR_INVALID_WINDOW_HANDLE );
1040         return 0;
1041     }
1042     if (!(winproc = wndPtr->winproc))
1043     {
1044         WIN_ReleasePtr( wndPtr );
1045         return 0;
1046     }
1047     painting = (msg->message == WM_PAINT);
1048     if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT;
1049     WIN_ReleasePtr( wndPtr );
1050 /*    hook_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
1051
1052     SPY_EnterMessage( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message,
1053                       msg->wParam, msg->lParam );
1054     retval = CallWindowProcA( winproc, msg->hwnd, msg->message,
1055                               msg->wParam, msg->lParam );
1056     SPY_ExitMessage( SPY_RESULT_OK, msg->hwnd, msg->message, retval,
1057                      msg->wParam, msg->lParam );
1058
1059     if (painting && (wndPtr = WIN_GetPtr( msg->hwnd )) && (wndPtr != WND_OTHER_PROCESS))
1060     {
1061         BOOL validate = ((wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate);
1062         wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
1063         WIN_ReleasePtr( wndPtr );
1064         if (validate)
1065         {
1066             ERR( "BeginPaint not called on WM_PAINT for hwnd %04x!\n", msg->hwnd );
1067             /* Validate the update region to avoid infinite WM_PAINT loop */
1068             RedrawWindow( msg->hwnd, NULL, 0,
1069                           RDW_NOFRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT );
1070         }
1071     }
1072     return retval;
1073 }
1074
1075
1076 /***********************************************************************
1077  *              DispatchMessageW (USER32.@) Process Message
1078  *
1079  * Process the message specified in the structure *_msg_.
1080  *
1081  * If the lpMsg parameter points to a WM_TIMER message and the
1082  * parameter of the WM_TIMER message is not NULL, the lParam parameter
1083  * points to the function that is called instead of the window
1084  * procedure.
1085  *  
1086  * The message must be valid.
1087  *
1088  * RETURNS
1089  *
1090  *   DispatchMessage() returns the result of the window procedure invoked.
1091  *
1092  * CONFORMANCE
1093  *
1094  *   ECMA-234, Win32 
1095  *
1096  */
1097 LONG WINAPI DispatchMessageW( const MSG* msg )
1098 {
1099     WND * wndPtr;
1100     LONG retval;
1101     int painting;
1102     WNDPROC winproc;
1103
1104       /* Process timer messages */
1105     if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
1106     {
1107         if (msg->lParam)
1108         {
1109 /*            HOOK_CallHooks32W( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
1110
1111             /* before calling window proc, verify whether timer is still valid;
1112                there's a slim chance that the application kills the timer
1113                between GetMessage and DispatchMessage API calls */
1114             if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, (HWINDOWPROC) msg->lParam))
1115                 return 0; /* invalid winproc */
1116
1117             return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd,
1118                                    msg->message, msg->wParam, GetTickCount() );
1119         }
1120     }
1121
1122     if (!(wndPtr = WIN_GetPtr( msg->hwnd )))
1123     {
1124         if (msg->hwnd) SetLastError( ERROR_INVALID_WINDOW_HANDLE );
1125         return 0;
1126     }
1127     if (wndPtr == WND_OTHER_PROCESS)
1128     {
1129         if (IsWindow( msg->hwnd ))
1130             ERR( "cannot dispatch msg to other process window %x\n", msg->hwnd );
1131         SetLastError( ERROR_INVALID_WINDOW_HANDLE );
1132         return 0;
1133     }
1134     if (!(winproc = wndPtr->winproc))
1135     {
1136         WIN_ReleasePtr( wndPtr );
1137         return 0;
1138     }
1139     painting = (msg->message == WM_PAINT);
1140     if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT;
1141     WIN_ReleasePtr( wndPtr );
1142 /*    HOOK_CallHooks32W( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
1143
1144     SPY_EnterMessage( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message,
1145                       msg->wParam, msg->lParam );
1146     retval = CallWindowProcW( winproc, msg->hwnd, msg->message,
1147                               msg->wParam, msg->lParam );
1148     SPY_ExitMessage( SPY_RESULT_OK, msg->hwnd, msg->message, retval,
1149                      msg->wParam, msg->lParam );
1150
1151     if (painting && (wndPtr = WIN_GetPtr( msg->hwnd )) && (wndPtr != WND_OTHER_PROCESS))
1152     {
1153         BOOL validate = ((wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate);
1154         wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
1155         WIN_ReleasePtr( wndPtr );
1156         if (validate)
1157         {
1158             ERR( "BeginPaint not called on WM_PAINT for hwnd %04x!\n", msg->hwnd );
1159             /* Validate the update region to avoid infinite WM_PAINT loop */
1160             RedrawWindow( msg->hwnd, NULL, 0,
1161                           RDW_NOFRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT );
1162         }
1163     }
1164     return retval;
1165 }
1166
1167
1168 /***********************************************************************
1169  *              RegisterWindowMessage (USER.118)
1170  *              RegisterWindowMessageA (USER32.@)
1171  */
1172 WORD WINAPI RegisterWindowMessageA( LPCSTR str )
1173 {
1174     TRACE("%s\n", str );
1175     return GlobalAddAtomA( str );
1176 }
1177
1178
1179 /***********************************************************************
1180  *              RegisterWindowMessageW (USER32.@)
1181  */
1182 WORD WINAPI RegisterWindowMessageW( LPCWSTR str )
1183 {
1184     TRACE("%p\n", str );
1185     return GlobalAddAtomW( str );
1186 }
1187
1188
1189 /***********************************************************************
1190  *              BroadcastSystemMessage (USER32.@)
1191  */
1192 LONG WINAPI BroadcastSystemMessage(
1193         DWORD dwFlags,LPDWORD recipients,UINT uMessage,WPARAM wParam,
1194         LPARAM lParam
1195 ) {
1196         FIXME("(%08lx,%08lx,%08x,%08x,%08lx): stub!\n",
1197               dwFlags,*recipients,uMessage,wParam,lParam
1198         );
1199         return 0;
1200 }