2003-10-02 06:32:56 +02:00
/*
* Unit tests for window message handling
*
* Copyright 1999 Ove Kaaven
* Copyright 2003 Dimitrie O . Paun
2005-01-11 11:38:31 +01:00
* Copyright 2004 , 2005 Dmitry Timoshkov
2003-10-02 06:32:56 +02:00
*
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation ; either
* version 2.1 of the License , or ( at your option ) any later version .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library ; if not , write to the Free Software
2006-05-18 14:49:52 +02:00
* Foundation , Inc . , 51 Franklin St , Fifth Floor , Boston , MA 02110 - 1301 , USA
2003-10-02 06:32:56 +02:00
*/
2010-04-21 13:29:55 +02:00
# define _WIN32_WINNT 0x0600 /* For WM_CHANGEUISTATE,QS_RAWINPUT,WM_DWMxxxx */
# define WINVER 0x0600 /* for WM_GETTITLEBARINFOEX */
2008-12-04 12:10:16 +01:00
2003-10-02 06:32:56 +02:00
# include <assert.h>
# include <stdarg.h>
2004-08-26 02:49:06 +02:00
# include <stdio.h>
2003-10-02 06:32:56 +02:00
# include "windef.h"
# include "winbase.h"
# include "wingdi.h"
# include "winuser.h"
2005-10-18 12:45:18 +02:00
# include "winnls.h"
2003-10-02 06:32:56 +02:00
# include "wine/test.h"
2004-06-30 20:16:08 +02:00
# define MDI_FIRST_CHILD_ID 2004
2003-10-02 06:32:56 +02:00
2004-09-13 20:03:09 +02:00
/* undocumented SWP flags - from SDK 3.1 */
# define SWP_NOCLIENTSIZE 0x0800
# define SWP_NOCLIENTMOVE 0x1000
2007-05-27 13:22:25 +02:00
# define SWP_STATECHANGED 0x8000
2004-09-13 20:03:09 +02:00
2006-05-23 11:55:02 +02:00
# define SW_NORMALNA 0xCC /* undoc. flag in MinMaximize */
2008-03-27 07:35:59 +01:00
# ifndef WM_KEYF1
# define WM_KEYF1 0x004d
# endif
2006-11-09 11:24:16 +01:00
# ifndef WM_SYSTIMER
# define WM_SYSTIMER 0x0118
# endif
2005-02-18 21:01:41 +01:00
# define WND_PARENT_ID 1
# define WND_POPUP_ID 2
# define WND_CHILD_ID 3
2007-10-25 22:26:48 +02:00
# ifndef WM_LBTRACKPOINT
# define WM_LBTRACKPOINT 0x0131
# endif
2007-10-02 12:08:15 +02:00
/* encoded DRAWITEMSTRUCT into an LPARAM */
typedef struct
{
union
{
struct
{
UINT type : 4 ; /* ODT_* flags */
UINT ctl_id : 4 ; /* Control ID */
UINT item_id : 4 ; /* Menu item ID */
UINT action : 4 ; /* ODA_* flags */
UINT state : 16 ; /* ODS_* flags */
} item ;
LPARAM lp ;
2007-10-11 18:33:16 +02:00
} u ;
2007-10-02 12:08:15 +02:00
} DRAW_ITEM_STRUCT ;
2005-02-18 21:01:41 +01:00
static BOOL test_DestroyWindow_flag ;
2005-01-06 21:43:34 +01:00
static HWINEVENTHOOK hEvent_hook ;
2009-01-16 12:33:07 +01:00
static HHOOK hCBT_hook ;
static DWORD cbt_hook_thread_id ;
2005-01-06 21:43:34 +01:00
2007-08-08 18:25:57 +02:00
static const WCHAR testWindowClassW [ ] =
{ ' T ' , ' e ' , ' s ' , ' t ' , ' W ' , ' i ' , ' n ' , ' d ' , ' o ' , ' w ' , ' C ' , ' l ' , ' a ' , ' s ' , ' s ' , ' W ' , 0 } ;
2003-10-02 06:32:56 +02:00
/*
FIXME : add tests for these
Window Edge Styles ( Win31 / Win95 / 98 look ) , in order of precedence :
WS_EX_DLGMODALFRAME : double border , WS_CAPTION allowed
WS_THICKFRAME : thick border
WS_DLGFRAME : double border , WS_CAPTION not allowed ( but possibly shown anyway )
WS_BORDER ( default for overlapped windows ) : single black border
none ( default for child ( and popup ? ) windows ) : no border
*/
2004-08-26 02:49:06 +02:00
typedef enum {
sent = 0x1 ,
posted = 0x2 ,
parent = 0x4 ,
wparam = 0x8 ,
lparam = 0x10 ,
defwinproc = 0x20 ,
beginpaint = 0x40 ,
optional = 0x80 ,
2005-01-06 21:43:34 +01:00
hook = 0x100 ,
winevent_hook = 0x200
2003-10-02 06:32:56 +02:00
} msg_flags_t ;
struct message {
UINT message ; /* the WM_* code */
msg_flags_t flags ; /* message props */
2004-03-26 00:35:52 +01:00
WPARAM wParam ; /* expected value of wParam */
LPARAM lParam ; /* expected value of lParam */
2009-01-15 15:43:58 +01:00
WPARAM wp_mask ; /* mask for wParam checks */
LPARAM lp_mask ; /* mask for lParam checks */
2003-10-02 06:32:56 +02:00
} ;
2009-01-12 21:03:57 +01:00
struct recvd_message {
UINT message ; /* the WM_* code */
msg_flags_t flags ; /* message props */
HWND hwnd ; /* window that received the message */
WPARAM wParam ; /* expected value of wParam */
LPARAM lParam ; /* expected value of lParam */
int line ; /* source line where logged */
const char * descr ; /* description for trace output */
2009-01-12 21:51:01 +01:00
char output [ 512 ] ; /* trace output */
2009-01-12 21:03:57 +01:00
} ;
2004-07-09 21:25:26 +02:00
/* Empty message sequence */
static const struct message WmEmptySeq [ ] =
{
{ 0 }
} ;
2003-10-02 06:32:56 +02:00
/* CreateWindow (for overlapped window, not initially visible) (16/32) */
2004-03-26 00:35:52 +01:00
static const struct message WmCreateOverlappedSeq [ ] = {
2004-03-26 01:18:20 +01:00
{ HCBT_CREATEWND , hook } ,
2003-10-02 06:32:56 +02:00
{ WM_GETMINMAXINFO , sent } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0094 , sent | defwinproc | optional } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ 0 }
} ;
2004-05-10 21:59:20 +02:00
/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
* for a not visible overlapped window .
*/
static const struct message WmSWP_ShowOverlappedSeq [ ] = {
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-05-10 21:59:20 +02:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
{ HCBT_ACTIVATE , hook } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_NOTIFYFORMAT , sent | optional } ,
{ WM_QUERYUISTATE , sent | optional } ,
2004-05-10 21:59:20 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* Win9x: SWP_NOSENDCHANGING */
2004-05-10 21:59:20 +02:00
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
2009-12-16 12:28:41 +01:00
{ WM_NCACTIVATE , sent } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2004-05-10 21:59:20 +02:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-05-10 21:59:20 +02:00
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2004-05-10 21:59:20 +02:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2004-09-13 20:03:09 +02:00
/* Win9x adds SWP_NOZORDER below */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2004-05-18 22:44:23 +02:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } ,
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2009-03-03 13:20:49 +01:00
{ WM_SYNCPAINT , sent | optional } ,
2009-03-09 17:54:16 +01:00
{ WM_GETTITLEBARINFOEX , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_PAINT , sent | optional } ,
{ WM_NCPAINT , sent | beginpaint | optional } ,
2010-05-25 16:28:04 +02:00
{ WM_GETTEXT , sent | beginpaint | defwinproc | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2004-05-10 21:59:20 +02:00
{ 0 }
} ;
/* SetWindowPos(SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE)
* for a visible overlapped window .
*/
static const struct message WmSWP_HideOverlappedSeq [ ] = {
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2009-02-26 14:28:38 +01:00
{ HCBT_ACTIVATE , hook | optional } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_ACTIVATEAPP , sent | wparam | optional , 1 } ,
{ WM_NCACTIVATE , sent | optional } ,
{ WM_ACTIVATE , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-05-10 21:59:20 +02:00
{ 0 }
} ;
2005-01-25 12:31:52 +01:00
/* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE)
* for a visible overlapped window .
*/
static const struct message WmSWP_ResizeSeq [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE | SWP_NOMOVE } ,
2005-01-25 12:31:52 +01:00
{ WM_GETMINMAXINFO , sent | defwinproc } ,
2009-02-26 14:28:38 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , TRUE } ,
2005-01-25 12:31:52 +01:00
{ WM_NCPAINT , sent | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2009-02-26 14:28:38 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | defwinproc | optional } ,
2005-01-25 12:31:52 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , TRUE } ,
{ WM_NCPAINT , sent | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2005-03-14 18:15:33 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* XP sends a duplicate */
2005-01-25 12:31:52 +01:00
{ 0 }
} ;
/* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE)
* for a visible popup window .
*/
static const struct message WmSWP_ResizePopupSeq [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE | SWP_NOMOVE } ,
{ WM_GETMINMAXINFO , sent | defwinproc | optional } , /* Win9x */
2009-02-26 14:28:38 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , TRUE } ,
2005-01-25 12:31:52 +01:00
{ WM_NCPAINT , sent | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2009-02-26 14:28:38 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | defwinproc | wparam | optional , SIZE_RESTORED } ,
2005-01-25 12:31:52 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , TRUE } ,
{ WM_NCPAINT , sent | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2005-03-14 18:15:33 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-01-25 12:31:52 +01:00
{ 0 }
} ;
/* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE)
* for a visible overlapped window .
*/
static const struct message WmSWP_MoveSeq [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE | SWP_NOSIZE } ,
2008-09-16 16:27:47 +02:00
{ WM_NCPAINT , sent | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCLIENTSIZE } ,
2005-01-25 12:31:52 +01:00
{ WM_MOVE , sent | defwinproc | wparam , 0 } ,
2005-03-14 18:15:33 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-01-25 12:31:52 +01:00
{ 0 }
} ;
2007-04-26 16:29:10 +02:00
/* Resize with SetWindowPos(SWP_NOZORDER)
* for a visible overlapped window
* SWP_NOZORDER is stripped by the logging code
*/
static const struct message WmSWP_ResizeNoZOrder [ ] = {
2008-07-31 17:16:22 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , /*SWP_NOZORDER|*/ SWP_NOACTIVATE } ,
2007-04-26 16:29:10 +02:00
{ WM_GETMINMAXINFO , sent | defwinproc } ,
2009-02-25 12:25:03 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } ,
{ WM_NCPAINT , sent | optional } ,
2007-04-26 16:29:10 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2009-02-25 12:25:03 +01:00
{ WM_ERASEBKGND , sent | optional } ,
2009-12-16 12:28:41 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , /*SWP_NOZORDER|*/ SWP_NOACTIVATE , 0 ,
2009-02-26 14:28:38 +01:00
SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOCLIENTSIZE } ,
2009-02-25 12:25:03 +01:00
{ WM_MOVE , sent | defwinproc | optional } ,
2009-02-26 14:28:38 +01:00
{ WM_SIZE , sent | defwinproc | optional } ,
2007-04-26 16:29:10 +02:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } , /* Win9x doesn't send it */
{ WM_NCPAINT , sent | optional } , /* Win9x doesn't send it */
{ WM_GETTEXT , sent | defwinproc | optional } , /* Win9x doesn't send it */
{ WM_ERASEBKGND , sent | optional } , /* Win9x doesn't send it */
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-04-26 16:29:10 +02:00
{ 0 }
} ;
2005-01-25 12:31:52 +01:00
2007-06-06 14:01:59 +02:00
/* Switch visible mdi children */
static const struct message WmSwitchChild [ ] = {
/* Switch MDI child */
{ WM_MDIACTIVATE , sent } , /* in the MDI client */
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOSIZE | SWP_NOMOVE } , /* in the 1st MDI child */
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2007-06-06 14:01:59 +02:00
{ WM_CHILDACTIVATE , sent } , /* in the 1st MDI child */
/* Deactivate 2nd MDI child */
2007-09-25 12:26:57 +02:00
{ WM_NCACTIVATE , sent | wparam | defwinproc , 0 } , /* in the 2nd MDI child */
{ WM_MDIACTIVATE , sent | defwinproc } , /* in the 2nd MDI child */
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
2007-06-06 14:01:59 +02:00
/* Preparing for maximize and maximaze the 1st MDI child */
2007-09-25 12:26:57 +02:00
{ WM_GETMINMAXINFO , sent | defwinproc } , /* in the 1st MDI child */
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_STATECHANGED } , /* in the 1st MDI child */
{ WM_NCCALCSIZE , sent | wparam | defwinproc , 1 } , /* in the 1st MDI child */
{ WM_CHILDACTIVATE , sent | defwinproc } , /* in the 1st MDI child */
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_STATECHANGED } , /* in the 1st MDI child */
2007-09-25 12:26:57 +02:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } , /* in the 1st MDI child */
2007-06-06 14:01:59 +02:00
/* Lock redraw 2nd MDI child */
2007-09-25 12:26:57 +02:00
{ WM_SETREDRAW , sent | wparam | defwinproc , 0 } , /* in the 2nd MDI child */
{ HCBT_MINMAX , hook | lparam , 0 , SW_NORMALNA } ,
2007-06-06 14:01:59 +02:00
/* Restore 2nd MDI child */
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_STATECHANGED } , /* in the 2nd MDI child */
2007-09-25 12:26:57 +02:00
{ WM_NCCALCSIZE , sent | wparam | defwinproc , 1 } , /* in the 2nd MDI child */
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } , /* in the 2nd MDI child */
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_STATECHANGED } , /* in the 2nd MDI child */
2007-09-25 12:26:57 +02:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } , /* in the 2nd MDI child */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* in the 2nd MDI child */
2007-06-06 14:01:59 +02:00
/* Redraw 2nd MDI child */
2007-09-25 12:26:57 +02:00
{ WM_SETREDRAW , sent | wparam | defwinproc , 1 } , /* in the 2nd MDI child */
/* Redraw MDI frame */
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE } , /* in MDI frame */
{ WM_NCCALCSIZE , sent | wparam , 1 } , /* in MDI frame */
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } , /* in MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* in MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* in the 1st MDI child */
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } , /* in the 1st MDI child */
{ WM_NCACTIVATE , sent | wparam | defwinproc , 1 } , /* in the 1st MDI child */
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent | defwinproc } , /* in the 2nd MDI child */
2007-09-28 17:22:37 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 0 } , /* in the 1st MDI child */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2007-06-06 14:01:59 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent } , /* in the MDI client */
2007-09-25 12:26:57 +02:00
{ HCBT_SETFOCUS , hook } ,
2007-06-06 14:01:59 +02:00
{ WM_KILLFOCUS , sent } , /* in the MDI client */
2007-09-28 17:22:37 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } , /* in the 1st MDI child */
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent | defwinproc } , /* in the 1st MDI child */
{ WM_MDIACTIVATE , sent | defwinproc } , /* in the 1st MDI child */
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } , /* in the 1st MDI child */
2007-06-06 14:01:59 +02:00
{ 0 }
} ;
2008-04-17 19:27:25 +02:00
/* Switch visible not maximized mdi children */
static const struct message WmSwitchNotMaximizedChild [ ] = {
/* Switch not maximized MDI child */
{ WM_MDIACTIVATE , sent } , /* in the MDI client */
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOSIZE | SWP_NOMOVE } , /* in the 2nd MDI child */
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_CHILDACTIVATE , sent } , /* in the 2nd MDI child */
/* Deactivate 1st MDI child */
{ WM_NCACTIVATE , sent | wparam | defwinproc , 0 } , /* in the 1st MDI child */
{ WM_MDIACTIVATE , sent | defwinproc } , /* in the 1st MDI child */
/* Activate 2nd MDI child */
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } , /* in the 2nd MDI child */
{ WM_NCACTIVATE , sent | wparam | defwinproc , 1 } , /* in the 2nd MDI child */
2008-05-30 04:57:58 +02:00
{ HCBT_SETFOCUS , hook } , /* in the 1st MDI child */
2008-04-17 19:27:25 +02:00
{ WM_KILLFOCUS , sent | defwinproc } , /* in the 1st MDI child */
2008-04-26 05:07:39 +02:00
{ WM_IME_SETCONTEXT , sent | defwinproc | optional } , /* in the 1st MDI child */
{ WM_IME_SETCONTEXT , sent | optional } , /* in the MDI client */
2008-04-17 19:27:25 +02:00
{ WM_SETFOCUS , sent , 0 } , /* in the MDI client */
2008-05-30 04:57:58 +02:00
{ HCBT_SETFOCUS , hook } ,
2008-04-17 19:27:25 +02:00
{ WM_KILLFOCUS , sent } , /* in the MDI client */
2008-04-26 05:07:39 +02:00
{ WM_IME_SETCONTEXT , sent | optional } , /* in the MDI client */
{ WM_IME_SETCONTEXT , sent | defwinproc | optional } , /* in the 1st MDI child */
2008-04-17 19:27:25 +02:00
{ WM_SETFOCUS , sent | defwinproc } , /* in the 2nd MDI child */
{ WM_MDIACTIVATE , sent | defwinproc } , /* in the 2nd MDI child */
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } , /* in the 2nd MDI child */
{ 0 }
} ;
2005-09-28 17:13:10 +02:00
/* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|
SWP_NOZORDER | SWP_FRAMECHANGED )
* for a visible overlapped window with WS_CLIPCHILDREN style set .
*/
static const struct message WmSWP_FrameChanged_clip [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | parent , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED } ,
2005-09-28 17:13:10 +02:00
{ WM_NCCALCSIZE , sent | wparam | parent , 1 } ,
2009-03-06 10:38:39 +01:00
{ WM_NCPAINT , sent | parent | optional } , /* wparam != 1 */
2005-10-19 21:06:35 +02:00
{ WM_GETTEXT , sent | parent | defwinproc | optional } ,
2005-09-28 17:13:10 +02:00
{ WM_ERASEBKGND , sent | parent | optional } , /* FIXME: remove optional once Wine is fixed */
{ WM_NCPAINT , sent } , /* wparam != 1 */
{ WM_ERASEBKGND , sent } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | parent , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-09-28 17:13:10 +02:00
{ WM_PAINT , sent } ,
{ 0 }
} ;
/* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_DEFERERASE|SWP_NOACTIVATE|
SWP_NOZORDER | SWP_FRAMECHANGED )
* for a visible overlapped window .
*/
static const struct message WmSWP_FrameChangedDeferErase [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | parent , SWP_NOSIZE | SWP_NOMOVE | SWP_DEFERERASE | SWP_NOACTIVATE | SWP_FRAMECHANGED } ,
2005-09-28 17:13:10 +02:00
{ WM_NCCALCSIZE , sent | wparam | parent , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | parent , SWP_NOSIZE | SWP_NOMOVE | SWP_DEFERERASE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2009-03-06 10:38:39 +01:00
{ WM_PAINT , sent | parent | optional } ,
{ WM_NCPAINT , sent | beginpaint | parent | optional } , /* wparam != 1 */
2005-10-19 21:06:35 +02:00
{ WM_GETTEXT , sent | beginpaint | parent | defwinproc | optional } ,
2005-09-28 17:13:10 +02:00
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | beginpaint } , /* wparam != 1 */
2009-03-06 10:38:39 +01:00
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2005-09-28 17:13:10 +02:00
{ 0 }
} ;
/* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|
SWP_NOZORDER | SWP_FRAMECHANGED )
* for a visible overlapped window without WS_CLIPCHILDREN style set .
*/
static const struct message WmSWP_FrameChanged_noclip [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | parent , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED } ,
2005-09-28 17:13:10 +02:00
{ WM_NCCALCSIZE , sent | wparam | parent , 1 } ,
2009-03-03 13:20:49 +01:00
{ WM_NCPAINT , sent | parent | optional } , /* wparam != 1 */
2005-10-19 21:06:35 +02:00
{ WM_GETTEXT , sent | parent | defwinproc | optional } ,
2009-03-03 13:20:49 +01:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | parent , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-09-28 17:13:10 +02:00
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | beginpaint } , /* wparam != 1 */
2009-03-05 14:26:55 +01:00
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2005-09-28 17:13:10 +02:00
{ 0 }
} ;
2004-05-10 21:59:20 +02:00
/* ShowWindow(SW_SHOW) for a not visible overlapped window */
2004-03-26 00:35:52 +01:00
static const struct message WmShowOverlappedSeq [ ] = {
2003-10-02 06:32:56 +02:00
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2004-03-26 00:35:52 +01:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-03-26 00:35:52 +01:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2004-03-26 01:18:20 +01:00
{ HCBT_ACTIVATE , hook } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-04-13 01:13:14 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
2006-05-23 11:55:02 +02:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
2003-10-02 06:32:56 +02:00
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
{ WM_NCACTIVATE , sent | wparam , 1 } ,
2004-05-06 00:01:49 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2003-10-02 06:32:56 +02:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
2004-03-26 01:18:20 +01:00
{ HCBT_SETFOCUS , hook } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2004-03-26 00:35:52 +01:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2004-09-13 20:03:09 +02:00
/* Win9x adds SWP_NOZORDER below */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-05-06 00:01:49 +02:00
{ WM_NCCALCSIZE , sent | optional } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2004-05-06 00:01:49 +02:00
{ WM_NCPAINT , sent | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2009-03-03 13:20:49 +01:00
{ WM_SYNCPAINT , sent | optional } ,
2004-05-10 21:59:20 +02:00
#if 0 /* CreateWindow/ShowWindow(SW_SHOW) also generates WM_SIZE/WM_MOVE
* messages . Does that mean that CreateWindow doesn ' t set initial
* window dimensions for overlapped windows ?
*/
{ WM_SIZE , sent } ,
{ WM_MOVE , sent } ,
# endif
2008-08-04 23:07:10 +02:00
{ WM_PAINT , sent | optional } ,
{ WM_NCPAINT , sent | beginpaint | optional } ,
2004-05-10 21:59:20 +02:00
{ 0 }
} ;
2005-09-12 12:09:40 +02:00
/* ShowWindow(SW_SHOWMAXIMIZED) for a not visible overlapped window */
static const struct message WmShowMaxOverlappedSeq [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2005-09-12 12:09:40 +02:00
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_NCCALCSIZE , sent | wparam , TRUE } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
{ HCBT_ACTIVATE , hook } ,
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
2005-09-12 12:09:40 +02:00
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
{ WM_NCACTIVATE , sent | wparam , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-09-12 12:09:40 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2005-09-12 12:09:40 +02:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
/* Win9x adds SWP_NOZORDER below */
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2005-09-12 12:09:40 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2005-09-12 12:09:40 +02:00
{ WM_NCCALCSIZE , sent | optional } ,
{ WM_NCPAINT , sent | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2009-03-03 13:20:49 +01:00
{ WM_SYNCPAINT , sent | optional } ,
2009-03-09 17:54:16 +01:00
{ WM_GETTITLEBARINFOEX , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_PAINT , sent | optional } ,
{ WM_NCPAINT , sent | beginpaint | optional } ,
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2005-09-12 12:09:40 +02:00
{ 0 }
} ;
2008-06-20 08:33:19 +02:00
/* ShowWindow(SW_RESTORE) for a not visible maximized overlapped window */
static const struct message WmShowRestoreMaxOverlappedSeq [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_RESTORE } ,
{ WM_GETTEXT , sent | optional } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_NCCALCSIZE , sent | wparam , TRUE } ,
2008-08-04 23:07:10 +02:00
{ WM_NCPAINT , sent | optional } ,
2008-06-20 08:33:19 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_ERASEBKGND , sent | optional } ,
2009-01-15 15:43:58 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOMOVE } ,
2008-09-16 16:27:47 +02:00
{ WM_MOVE , sent | defwinproc | optional } ,
2008-06-20 08:33:19 +02:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2008-07-31 17:16:22 +02:00
{ WM_NCCALCSIZE , sent | wparam | optional , TRUE } ,
2008-08-04 23:07:10 +02:00
{ WM_NCPAINT , sent | optional } ,
2008-07-31 17:16:22 +02:00
{ WM_ERASEBKGND , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_PAINT , sent | optional } ,
2009-03-09 17:54:16 +01:00
{ WM_GETTITLEBARINFOEX , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_NCPAINT , sent | beginpaint | optional } ,
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2008-06-20 08:33:19 +02:00
{ 0 }
} ;
/* ShowWindow(SW_RESTORE) for a not visible minimized overlapped window */
static const struct message WmShowRestoreMinOverlappedSeq [ ] = {
2009-02-13 13:02:08 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_RESTORE } ,
2008-06-20 08:33:19 +02:00
{ WM_QUERYOPEN , sent | optional } ,
{ WM_GETTEXT , sent | optional } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED | SWP_NOCOPYBITS } ,
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_NCCALCSIZE , sent | wparam , TRUE } ,
{ HCBT_ACTIVATE , hook } ,
2008-09-16 16:27:47 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
2008-06-20 08:33:19 +02:00
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
{ WM_NCACTIVATE , sent | wparam , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2008-06-20 08:33:19 +02:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_STATECHANGED | SWP_FRAMECHANGED | SWP_NOCOPYBITS } ,
{ WM_MOVE , sent | defwinproc } ,
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2008-07-31 17:16:22 +02:00
{ WM_NCCALCSIZE , sent | wparam | optional , TRUE } ,
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
2008-06-20 08:33:19 +02:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_PAINT , sent | optional } ,
2009-03-09 17:54:16 +01:00
{ WM_GETTITLEBARINFOEX , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_NCPAINT , sent | beginpaint | optional } ,
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2008-06-20 08:33:19 +02:00
{ 0 }
} ;
2007-04-12 02:45:42 +02:00
/* ShowWindow(SW_SHOWMINIMIZED) for a not visible overlapped window */
static const struct message WmShowMinOverlappedSeq [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MINIMIZE } ,
{ HCBT_SETFOCUS , hook } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2007-04-12 02:45:42 +02:00
{ WM_KILLFOCUS , sent } ,
2007-04-26 16:29:10 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_NOTIFY , sent | wparam | optional | defwinproc , 1 } ,
{ WM_GETTEXT , sent | optional } ,
2007-04-12 02:45:42 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_STATECHANGED } ,
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_NCCALCSIZE , sent | wparam , TRUE } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-08-04 23:07:10 +02:00
{ WM_NCPAINT , sent | optional } ,
2007-04-12 02:45:42 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_WINDOWPOSCHANGED , sent } ,
{ WM_MOVE , sent | defwinproc } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | defwinproc | wparam | lparam , SIZE_MINIMIZED , 0 } ,
2007-04-12 02:45:42 +02:00
{ WM_NCCALCSIZE , sent | optional } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ EVENT_SYSTEM_MINIMIZESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-04-12 02:45:42 +02:00
{ WM_NCACTIVATE , sent | wparam , 0 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ACTIVATE , sent } ,
{ WM_ACTIVATEAPP , sent | wparam , 0 } ,
2009-03-13 11:29:53 +01:00
2009-02-21 12:57:23 +01:00
/* Vista sometimes restores the window right away... */
2009-02-12 17:52:54 +01:00
{ WM_SYSCOMMAND , sent | optional | wparam , SC_RESTORE } ,
2009-02-13 13:02:08 +01:00
{ HCBT_SYSCOMMAND , hook | optional | wparam , SC_RESTORE } ,
2009-02-21 12:57:23 +01:00
{ HCBT_MINMAX , hook | optional | lparam , 0 , SW_RESTORE } ,
2009-03-13 11:29:53 +01:00
{ WM_QUERYOPEN , sent | optional } ,
{ WM_WINDOWPOSCHANGING , sent | optional | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
{ WM_GETMINMAXINFO , sent | optional | defwinproc } ,
{ WM_NCCALCSIZE , sent | optional | wparam , TRUE } ,
{ HCBT_ACTIVATE , hook | optional } ,
{ WM_ACTIVATEAPP , sent | optional | wparam , 1 } ,
{ WM_NCACTIVATE , sent | optional } ,
{ WM_GETTEXT , sent | optional } ,
{ WM_ACTIVATE , sent | optional | wparam , 1 } ,
{ HCBT_SETFOCUS , hook | optional } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
{ WM_SETFOCUS , sent | optional } ,
{ WM_NCPAINT , sent | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
{ WM_WINDOWPOSCHANGED , sent | optional | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
{ WM_MOVE , sent | defwinproc | optional } ,
{ WM_SIZE , sent | defwinproc | optional | wparam , SIZE_RESTORED } ,
{ WM_ACTIVATE , sent | optional | wparam , 1 } ,
{ WM_SYSCOMMAND , sent | optional | wparam , SC_RESTORE } ,
{ HCBT_SYSCOMMAND , hook | optional | wparam , SC_RESTORE } ,
2008-08-04 23:07:10 +02:00
{ WM_PAINT , sent | optional } ,
{ WM_NCPAINT , sent | beginpaint | optional } ,
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2007-04-12 02:45:42 +02:00
{ 0 }
} ;
2004-05-10 21:59:20 +02:00
/* ShowWindow(SW_HIDE) for a visible overlapped window */
static const struct message WmHideOverlappedSeq [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-11-14 12:24:06 +01:00
{ WM_SIZE , sent | optional } , /* XP doesn't send it */
{ WM_MOVE , sent | optional } , /* XP doesn't send it */
2009-12-16 12:28:41 +01:00
{ WM_NCACTIVATE , sent | wparam | optional , 0 } ,
{ WM_ACTIVATE , sent | wparam | optional , 0 } ,
{ WM_ACTIVATEAPP , sent | wparam | optional , 0 } ,
{ HCBT_SETFOCUS , hook | optional } ,
2004-05-10 21:59:20 +02:00
{ WM_KILLFOCUS , sent | wparam , 0 } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | optional | defwinproc , 1 } ,
2003-10-02 06:32:56 +02:00
{ 0 }
} ;
2004-05-10 21:59:20 +02:00
/* DestroyWindow for a visible overlapped window */
2004-03-26 00:35:52 +01:00
static const struct message WmDestroyOverlappedSeq [ ] = {
2004-03-26 01:18:20 +01:00
{ HCBT_DESTROYWND , hook } ,
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2008-08-04 23:07:10 +02:00
{ WM_NCACTIVATE , sent | optional | wparam , 0 } ,
2009-02-26 14:28:38 +01:00
{ WM_ACTIVATE , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_ACTIVATEAPP , sent | optional | wparam , 0 } ,
{ WM_KILLFOCUS , sent | optional | wparam , 0 } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | optional | defwinproc , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_DESTROY , sent } ,
{ WM_NCDESTROY , sent } ,
{ 0 }
} ;
2005-11-30 12:32:22 +01:00
/* CreateWindow(WS_MAXIMIZE|WS_VISIBLE) for popup window */
static const struct message WmCreateMaxPopupSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2005-11-30 12:32:22 +01:00
{ WM_MOVE , sent } ,
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2005-11-30 12:32:22 +01:00
{ WM_NCCALCSIZE , sent | wparam , TRUE } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOREDRAW | SWP_STATECHANGED } ,
2005-11-30 12:32:22 +01:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ HCBT_ACTIVATE , hook } ,
2007-09-25 12:26:57 +02:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
2008-10-17 19:05:11 +02:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE | SWP_NOMOVE | SWP_NOSIZE } ,
2005-11-30 12:32:22 +01:00
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
2009-02-26 14:28:38 +01:00
{ WM_NCACTIVATE , sent } ,
2005-11-30 12:32:22 +01:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2005-11-30 12:32:22 +01:00
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2005-11-30 12:32:22 +01:00
{ WM_SYNCPAINT , sent | wparam | optional , 4 } ,
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
2009-01-20 14:02:02 +01:00
{ WM_NCPAINT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_ERASEBKGND , sent | defwinproc | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE } ,
2005-11-30 12:32:22 +01:00
{ 0 }
} ;
/* CreateWindow(WS_MAXIMIZE) for popup window, not initially visible */
static const struct message WmCreateInvisibleMaxPopupSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2005-11-30 12:32:22 +01:00
{ WM_MOVE , sent } ,
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2005-11-30 12:32:22 +01:00
{ WM_NCCALCSIZE , sent | wparam , TRUE } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOREDRAW | SWP_STATECHANGED } ,
2005-11-30 12:32:22 +01:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ 0 }
} ;
/* ShowWindow(SW_SHOWMAXIMIZED) for a resized not visible popup window */
static const struct message WmShowMaxPopupResizedSeq [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED } ,
{ WM_NCCALCSIZE , sent | wparam , TRUE } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ HCBT_ACTIVATE , hook } ,
2007-09-25 12:26:57 +02:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
2009-01-29 22:09:11 +01:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-11-30 12:32:22 +01:00
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
2009-02-26 14:28:38 +01:00
{ WM_NCACTIVATE , sent } ,
2005-11-30 12:32:22 +01:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2005-11-30 12:32:22 +01:00
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2005-11-30 12:32:22 +01:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_WINDOWPOSCHANGED , sent } ,
2005-11-30 12:32:22 +01:00
/* WinNT4.0 sends WM_MOVE */
{ WM_MOVE , sent | defwinproc | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ 0 }
} ;
/* ShowWindow(SW_SHOWMAXIMIZED) for a not visible popup window */
static const struct message WmShowMaxPopupSeq [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED } ,
{ WM_NCCALCSIZE , sent | wparam , TRUE } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ HCBT_ACTIVATE , hook } ,
2007-09-25 12:26:57 +02:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
2009-02-26 14:28:38 +01:00
{ WM_NCACTIVATE , sent } ,
2005-11-30 12:32:22 +01:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2005-11-30 12:32:22 +01:00
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2005-11-30 12:32:22 +01:00
{ WM_SYNCPAINT , sent | wparam | optional , 4 } ,
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
2009-01-20 14:02:02 +01:00
{ WM_NCPAINT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_ERASEBKGND , sent | defwinproc | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ 0 }
} ;
/* CreateWindow(WS_VISIBLE) for popup window */
static const struct message WmCreatePopupSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2005-11-30 12:32:22 +01:00
{ WM_MOVE , sent } ,
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ HCBT_ACTIVATE , hook } ,
2007-09-25 12:26:57 +02:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
2009-01-19 12:36:11 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-11-30 12:32:22 +01:00
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
2009-02-26 14:28:38 +01:00
{ WM_NCACTIVATE , sent } ,
2005-11-30 12:32:22 +01:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2005-11-30 12:32:22 +01:00
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2005-11-30 12:32:22 +01:00
{ WM_SYNCPAINT , sent | wparam | optional , 4 } ,
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE } ,
2005-11-30 12:32:22 +01:00
{ 0 }
} ;
/* ShowWindow(SW_SHOWMAXIMIZED) for a visible popup window */
static const struct message WmShowVisMaxPopupSeq [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
{ WM_GETTEXT , sent | optional } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2005-11-30 12:32:22 +01:00
{ WM_NCCALCSIZE , sent | wparam , TRUE } ,
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2005-11-30 12:32:22 +01:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-30 12:32:22 +01:00
{ 0 }
} ;
2004-04-02 22:22:53 +02:00
/* CreateWindow (for a child popup window, not initially visible) */
static const struct message WmCreateChildPopupSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-04-02 22:22:53 +02:00
{ WM_MOVE , sent } ,
{ 0 }
} ;
/* CreateWindow (for a popup window, not initially visible,
* which sets WS_VISIBLE in WM_CREATE handler )
*/
static const struct message WmCreateInvisiblePopupSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
{ WM_STYLECHANGING , sent } ,
{ WM_STYLECHANGED , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-04-02 22:22:53 +02:00
{ WM_MOVE , sent } ,
{ 0 }
} ;
/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER)
* for a popup window with WS_VISIBLE style set
*/
static const struct message WmShowVisiblePopupSeq_2 [ ] = {
2009-01-12 21:03:57 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-04-02 22:22:53 +02:00
{ 0 }
} ;
/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
* for a popup window with WS_VISIBLE style set
*/
static const struct message WmShowVisiblePopupSeq_3 [ ] = {
2009-01-12 21:03:57 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2004-04-02 22:22:53 +02:00
{ HCBT_ACTIVATE , hook } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-04-13 01:13:14 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2009-01-12 21:03:57 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
2009-02-26 14:28:38 +01:00
{ WM_NCACTIVATE , sent } ,
2004-04-02 22:22:53 +02:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
2004-04-20 06:02:50 +02:00
{ WM_KILLFOCUS , sent | parent } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | parent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-04-02 22:22:53 +02:00
{ WM_SETFOCUS , sent | defwinproc } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2009-06-03 11:31:10 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE , 0 , SWP_SHOWWINDOW } ,
2004-04-02 22:22:53 +02:00
{ 0 }
} ;
2003-10-02 06:32:56 +02:00
/* CreateWindow (for child window, not initially visible) */
2004-03-26 00:35:52 +01:00
static const struct message WmCreateChildSeq [ ] = {
2004-03-26 01:18:20 +01:00
{ HCBT_CREATEWND , hook } ,
2003-10-02 06:32:56 +02:00
{ WM_NCCREATE , sent } ,
/* child is inserted into parent's child list after WM_NCCREATE returns */
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2003-10-02 06:32:56 +02:00
{ WM_MOVE , sent } ,
2004-04-30 06:15:13 +02:00
{ WM_PARENTNOTIFY , sent | parent | wparam , WM_CREATE } ,
2003-10-02 06:32:56 +02:00
{ 0 }
} ;
2004-04-29 22:00:40 +02:00
/* CreateWindow (for maximized child window, not initially visible) */
static const struct message WmCreateMaximizedChildSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-04-29 22:00:40 +02:00
{ WM_MOVE , sent } ,
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_STATECHANGED } ,
2004-06-30 20:16:08 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-04-30 06:15:13 +02:00
{ WM_PARENTNOTIFY , sent | parent | wparam , WM_CREATE } ,
2004-04-29 22:00:40 +02:00
{ 0 }
} ;
2004-06-18 21:33:55 +02:00
/* CreateWindow (for a child window, initially visible) */
static const struct message WmCreateVisibleChildSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
/* child is inserted into parent's child list after WM_NCCREATE returns */
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-18 21:33:55 +02:00
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-06-18 21:33:55 +02:00
{ WM_MOVE , sent } ,
{ WM_PARENTNOTIFY , sent | parent | wparam , WM_CREATE } ,
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-18 21:33:55 +02:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-03-14 11:05:50 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } , /* WinXP */
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-18 21:33:55 +02:00
{ 0 }
} ;
2004-05-10 21:59:20 +02:00
/* ShowWindow(SW_SHOW) for a not visible child window */
2004-03-26 00:35:52 +01:00
static const struct message WmShowChildSeq [ ] = {
2003-10-02 06:32:56 +02:00
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-03-26 00:35:52 +01:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-09-13 20:03:09 +02:00
{ 0 }
} ;
/* ShowWindow(SW_HIDE) for a visible child window */
static const struct message WmHideChildSeq [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-09-13 20:03:09 +02:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2003-10-02 06:32:56 +02:00
{ 0 }
} ;
2007-07-27 03:27:53 +02:00
/* ShowWindow(SW_HIDE) for a visible child window checking all parent events*/
static const struct message WmHideChildSeq2 [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2009-01-20 14:02:02 +01:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2007-07-27 03:27:53 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
{ 0 }
} ;
2004-06-18 21:33:55 +02:00
/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
* for a not visible child window
*/
static const struct message WmShowChildSeq_2 [ ] = {
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-18 21:33:55 +02:00
{ WM_CHILDACTIVATE , sent } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-06-18 21:33:55 +02:00
{ 0 }
} ;
/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE)
* for a not visible child window
*/
static const struct message WmShowChildSeq_3 [ ] = {
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-06-18 21:33:55 +02:00
{ 0 }
} ;
2004-09-21 02:24:22 +02:00
/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
* for a visible child window with a caption
*/
static const struct message WmShowChildSeq_4 [ ] = {
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_CHILDACTIVATE , sent } ,
{ 0 }
} ;
2006-05-16 12:33:19 +02:00
/* ShowWindow(SW_MINIMIZE) for child with invisible parent */
static const struct message WmShowChildInvisibleParentSeq_1 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MINIMIZE } ,
2009-01-15 15:43:58 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED , 0 , SWP_NOACTIVATE } ,
2006-05-16 12:33:19 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-09-19 12:07:18 +02:00
{ WM_CHILDACTIVATE , sent | optional } ,
2009-01-15 15:43:58 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOREDRAW | SWP_NOCOPYBITS | SWP_STATECHANGED , 0 , SWP_NOACTIVATE } ,
2006-05-16 12:33:19 +02:00
{ WM_MOVE , sent | defwinproc } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | defwinproc | wparam | lparam , SIZE_MINIMIZED , 0 } ,
2006-05-16 12:33:19 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_SYSTEM_MINIMIZESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
2006-05-17 09:35:26 +02:00
/* FIXME: Wine creates an icon/title window while Windows doesn't */
{ WM_PARENTNOTIFY , sent | parent | wparam | optional , WM_CREATE } ,
{ WM_GETTEXT , sent | optional } ,
2006-05-16 12:33:19 +02:00
{ 0 }
} ;
/* repeated ShowWindow(SW_MINIMIZE) for child with invisible parent */
static const struct message WmShowChildInvisibleParentSeq_1r [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MINIMIZE } ,
{ 0 }
} ;
/* ShowWindow(SW_MAXIMIZE) for child with invisible parent */
static const struct message WmShowChildInvisibleParentSeq_2 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2006-05-16 12:33:19 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2006-05-16 12:33:19 +02:00
{ WM_CHILDACTIVATE , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2006-05-16 12:33:19 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
/* repeated ShowWindow(SW_MAXIMIZE) for child with invisible parent */
static const struct message WmShowChildInvisibleParentSeq_2r [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ 0 }
} ;
/* ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
static const struct message WmShowChildInvisibleParentSeq_3 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMINIMIZED } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-05-16 12:33:19 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2006-05-16 12:33:19 +02:00
{ WM_CHILDACTIVATE , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOREDRAW | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-05-16 12:33:19 +02:00
{ WM_MOVE , sent | defwinproc } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | defwinproc | wparam | lparam , SIZE_MINIMIZED , 0 } ,
2006-05-16 12:33:19 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_SYSTEM_MINIMIZESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
2006-05-17 09:35:26 +02:00
/* FIXME: Wine creates an icon/title window while Windows doesn't */
{ WM_PARENTNOTIFY , sent | parent | wparam | optional , WM_CREATE } ,
{ WM_GETTEXT , sent | optional } ,
2006-05-16 12:33:19 +02:00
{ 0 }
} ;
/* repeated ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
static const struct message WmShowChildInvisibleParentSeq_3r [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMINIMIZED } ,
{ 0 }
} ;
/* ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
static const struct message WmShowChildInvisibleParentSeq_4 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMINNOACTIVE } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-05-16 12:33:19 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-05-16 12:33:19 +02:00
{ WM_MOVE , sent | defwinproc } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | defwinproc | wparam | lparam , SIZE_MINIMIZED , 0 } ,
2006-05-16 12:33:19 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-09-25 12:26:57 +02:00
{ EVENT_SYSTEM_MINIMIZESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
2006-05-17 09:35:26 +02:00
/* FIXME: Wine creates an icon/title window while Windows doesn't */
{ WM_PARENTNOTIFY , sent | parent | wparam | optional , WM_CREATE } ,
{ WM_GETTEXT , sent | optional } ,
2006-05-16 12:33:19 +02:00
{ 0 }
} ;
/* repeated ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
static const struct message WmShowChildInvisibleParentSeq_4r [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMINNOACTIVE } ,
{ 0 }
} ;
2004-09-09 00:02:23 +02:00
/* ShowWindow(SW_SHOW) for child with invisible parent */
2006-05-16 12:33:19 +02:00
static const struct message WmShowChildInvisibleParentSeq_5 [ ] = {
2004-09-09 00:02:23 +02:00
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ 0 }
} ;
/* ShowWindow(SW_HIDE) for child with invisible parent */
static const struct message WmHideChildInvisibleParentSeq [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
{ 0 }
} ;
/* SetWindowPos(SWP_SHOWWINDOW) for child with invisible parent */
2006-05-16 12:33:19 +02:00
static const struct message WmShowChildInvisibleParentSeq_6 [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-09-09 00:02:23 +02:00
{ 0 }
} ;
/* SetWindowPos(SWP_HIDEWINDOW) for child with invisible parent */
static const struct message WmHideChildInvisibleParentSeq_2 [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-09-09 00:02:23 +02:00
{ 0 }
} ;
2004-05-10 21:59:20 +02:00
/* DestroyWindow for a visible child window */
2004-03-26 00:35:52 +01:00
static const struct message WmDestroyChildSeq [ ] = {
2004-03-26 01:18:20 +01:00
{ HCBT_DESTROYWND , hook } ,
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2004-04-30 06:15:13 +02:00
{ WM_PARENTNOTIFY , sent | parent | wparam , WM_DESTROY } ,
2003-10-02 06:32:56 +02:00
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-03-26 00:35:52 +01:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-03-26 02:06:15 +01:00
{ HCBT_SETFOCUS , hook } , /* set focus to a parent */
{ WM_KILLFOCUS , sent } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | parent | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-05-20 03:17:28 +02:00
{ WM_SETFOCUS , sent | parent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_DESTROY , sent } ,
2005-01-06 21:43:34 +01:00
{ WM_DESTROY , sent | optional } , /* some other (IME?) window */
{ WM_NCDESTROY , sent | optional } , /* some other (IME?) window */
2003-10-02 06:32:56 +02:00
{ WM_NCDESTROY , sent } ,
{ 0 }
} ;
2009-06-03 11:31:10 +02:00
/* visible child window destroyed by thread exit */
static const struct message WmExitThreadSeq [ ] = {
{ WM_NCDESTROY , sent } , /* actually in grandchild */
{ WM_PAINT , sent | parent } ,
{ WM_ERASEBKGND , sent | parent | beginpaint } ,
{ 0 }
} ;
2005-11-09 11:35:48 +01:00
/* DestroyWindow for a visible child window with invisible parent */
static const struct message WmDestroyInvisibleChildSeq [ ] = {
{ HCBT_DESTROYWND , hook } ,
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2005-11-09 11:35:48 +01:00
{ WM_PARENTNOTIFY , sent | parent | wparam , WM_DESTROY } ,
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-09 11:35:48 +01:00
{ WM_DESTROY , sent } ,
{ WM_NCDESTROY , sent } ,
{ 0 }
} ;
2003-10-02 06:32:56 +02:00
/* Moving the mouse in nonclient area */
2004-03-26 00:35:52 +01:00
static const struct message WmMouseMoveInNonClientAreaSeq [ ] = { /* FIXME: add */
2003-10-02 06:32:56 +02:00
{ WM_NCHITTEST , sent } ,
{ WM_SETCURSOR , sent } ,
{ WM_NCMOUSEMOVE , posted } ,
{ 0 }
} ;
/* Moving the mouse in client area */
2004-03-26 00:35:52 +01:00
static const struct message WmMouseMoveInClientAreaSeq [ ] = { /* FIXME: add */
2003-10-02 06:32:56 +02:00
{ WM_NCHITTEST , sent } ,
{ WM_SETCURSOR , sent } ,
{ WM_MOUSEMOVE , posted } ,
{ 0 }
} ;
/* Moving by dragging the title bar (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
2004-03-26 00:35:52 +01:00
static const struct message WmDragTitleBarSeq [ ] = { /* FIXME: add */
2003-10-02 06:32:56 +02:00
{ WM_NCLBUTTONDOWN , sent | wparam , HTCAPTION } ,
{ WM_SYSCOMMAND , sent | defwinproc | wparam , SC_MOVE + 2 } ,
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_ENTERSIZEMOVE , sent | defwinproc } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , 0 } ,
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_MOVE , sent | defwinproc } ,
{ WM_EXITSIZEMOVE , sent | defwinproc } ,
{ 0 }
} ;
/* Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
2004-03-26 02:06:15 +01:00
static const struct message WmDragThickBordersBarSeq [ ] = { /* FIXME: add */
2003-10-02 06:32:56 +02:00
{ WM_NCLBUTTONDOWN , sent | wparam , 0xd } ,
{ WM_SYSCOMMAND , sent | defwinproc | wparam , 0xf004 } ,
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_ENTERSIZEMOVE , sent | defwinproc } ,
{ WM_SIZING , sent | defwinproc | wparam , 4 } , /* one for each mouse movement */
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_NCCALCSIZE , sent | defwinproc | wparam , 1 } ,
{ WM_NCPAINT , sent | defwinproc | wparam , 1 } ,
{ WM_GETTEXT , sent | defwinproc } ,
{ WM_ERASEBKGND , sent | defwinproc } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2003-10-02 06:32:56 +02:00
{ WM_EXITSIZEMOVE , sent | defwinproc } ,
{ 0 }
} ;
/* Resizing child window with MoveWindow (32) */
2004-03-26 00:35:52 +01:00
static const struct message WmResizingChildWithMoveWindowSeq [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE } ,
2003-10-02 06:32:56 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-08-27 15:13:51 +02:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2004-03-26 00:35:52 +01:00
{ WM_ERASEBKGND , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE } ,
2003-10-02 06:32:56 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ 0 }
} ;
/* Clicking on inactive button */
2004-03-26 00:35:52 +01:00
static const struct message WmClickInactiveButtonSeq [ ] = { /* FIXME: add */
2003-10-02 06:32:56 +02:00
{ WM_NCHITTEST , sent } ,
{ WM_PARENTNOTIFY , sent | parent | wparam , WM_LBUTTONDOWN } ,
{ WM_MOUSEACTIVATE , sent } ,
{ WM_MOUSEACTIVATE , sent | parent | defwinproc } ,
{ WM_SETCURSOR , sent } ,
{ WM_SETCURSOR , sent | parent | defwinproc } ,
{ WM_LBUTTONDOWN , posted } ,
{ WM_KILLFOCUS , posted | parent } ,
{ WM_SETFOCUS , posted } ,
{ WM_CTLCOLORBTN , posted | parent } ,
{ BM_SETSTATE , posted } ,
{ WM_CTLCOLORBTN , posted | parent } ,
{ WM_LBUTTONUP , posted } ,
{ BM_SETSTATE , posted } ,
{ WM_CTLCOLORBTN , posted | parent } ,
{ WM_COMMAND , posted | parent } ,
{ 0 }
} ;
/* Reparenting a button (16/32) */
/* The last child (button) reparented gets topmost for its new parent. */
2004-03-26 00:35:52 +01:00
static const struct message WmReparentButtonSeq [ ] = { /* FIXME: add */
2003-10-02 06:32:56 +02:00
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_ERASEBKGND , sent | parent } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOSIZE } ,
2003-10-02 06:32:56 +02:00
{ WM_CHILDACTIVATE , sent } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOSIZE | SWP_NOREDRAW } ,
2003-10-02 06:32:56 +02:00
{ WM_MOVE , sent | defwinproc } ,
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ 0 }
} ;
2004-04-20 06:02:50 +02:00
/* Creation of a custom dialog (32) */
static const struct message WmCreateCustomDialogSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_GETMINMAXINFO , sent } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-04-20 06:02:50 +02:00
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_NOTIFYFORMAT , sent | optional } ,
{ WM_QUERYUISTATE , sent | optional } ,
{ WM_WINDOWPOSCHANGING , sent | optional } ,
{ WM_GETMINMAXINFO , sent | optional } ,
{ WM_NCCALCSIZE , sent | optional } ,
{ WM_WINDOWPOSCHANGED , sent | optional } ,
2004-04-20 06:02:50 +02:00
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2005-01-06 21:43:34 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
{ HCBT_ACTIVATE , hook } ,
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-01-11 16:45:32 +01:00
2005-01-11 11:38:31 +01:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
2009-02-26 14:28:38 +01:00
{ WM_NCACTIVATE , sent } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional | defwinproc } ,
{ WM_GETTEXT , sent | optional | defwinproc } ,
2009-01-29 22:09:11 +01:00
{ WM_GETTEXT , sent | optional | defwinproc } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_DEFACTIONCHANGE , winevent_hook | wparam | lparam | optional , OBJID_CLIENT , 0 } ,
2004-04-20 06:02:50 +02:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2004-04-20 06:02:50 +02:00
{ WM_KILLFOCUS , sent | parent } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | parent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-04-20 06:02:50 +02:00
{ WM_SETFOCUS , sent } ,
{ WM_GETDLGCODE , sent | defwinproc | wparam , 0 } ,
{ WM_NCPAINT , sent | wparam , 1 } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional | defwinproc } ,
{ WM_GETTEXT , sent | optional | defwinproc } ,
2004-04-20 06:02:50 +02:00
{ WM_ERASEBKGND , sent } ,
2009-02-25 12:25:03 +01:00
{ WM_CTLCOLORDLG , sent | optional | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional } ,
{ WM_GETTEXT , sent | optional } ,
{ WM_NCCALCSIZE , sent | optional } ,
{ WM_NCPAINT , sent | optional } ,
{ WM_GETTEXT , sent | optional | defwinproc } ,
{ WM_GETTEXT , sent | optional | defwinproc } ,
{ WM_ERASEBKGND , sent | optional } ,
{ WM_CTLCOLORDLG , sent | optional | defwinproc } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-04-20 06:02:50 +02:00
{ WM_MOVE , sent } ,
{ 0 }
} ;
2004-05-18 22:44:23 +02:00
/* Calling EndDialog for a custom dialog (32) */
static const struct message WmEndCustomDialogSeq [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional } ,
{ HCBT_ACTIVATE , hook } ,
{ WM_NCACTIVATE , sent | wparam , 0 } ,
{ WM_GETTEXT , sent | optional | defwinproc } ,
{ WM_GETTEXT , sent | optional | defwinproc } ,
{ WM_ACTIVATE , sent | wparam , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2009-03-03 13:20:49 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
{ WM_GETTEXT , sent | optional | defwinproc } ,
2009-03-09 17:54:16 +01:00
{ WM_GETTEXT , sent | optional | defwinproc } ,
2004-05-18 22:44:23 +02:00
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | parent | wparam | defwinproc | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-05-20 03:17:28 +02:00
{ WM_SETFOCUS , sent | parent | defwinproc } ,
2004-05-18 22:44:23 +02:00
{ 0 }
} ;
2005-01-06 21:43:34 +01:00
/* ShowWindow(SW_SHOW) for a custom dialog (initially invisible) */
static const struct message WmShowCustomDialogSeq [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
{ HCBT_ACTIVATE , hook } ,
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-01-11 11:38:31 +01:00
2005-01-06 21:43:34 +01:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2005-01-11 11:38:31 +01:00
2008-09-16 16:27:47 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ WM_ACTIVATEAPP , sent | wparam | optional , 1 } ,
2009-02-26 14:28:38 +01:00
{ WM_NCACTIVATE , sent } ,
2005-01-06 21:43:34 +01:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2005-01-06 21:43:34 +01:00
{ WM_KILLFOCUS , sent | parent } ,
{ WM_IME_SETCONTEXT , sent | parent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent } ,
{ WM_GETDLGCODE , sent | defwinproc | wparam , 0 } ,
{ WM_NCPAINT , sent | wparam , 1 } ,
{ WM_ERASEBKGND , sent } ,
{ WM_CTLCOLORDLG , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ 0 }
} ;
2004-05-18 22:44:23 +02:00
/* Creation and destruction of a modal dialog (32) */
static const struct message WmModalDialogSeq [ ] = {
2003-10-02 06:32:56 +02:00
{ WM_CANCELMODE , sent | parent } ,
2004-08-10 01:38:40 +02:00
{ HCBT_SETFOCUS , hook } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_KILLFOCUS , sent | parent } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | parent | wparam | optional , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_STATECHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_ENABLE , sent | parent | wparam , 0 } ,
2004-06-01 21:39:26 +02:00
{ HCBT_CREATEWND , hook } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_SETFONT , sent } ,
{ WM_INITDIALOG , sent } ,
2004-05-18 22:44:23 +02:00
{ WM_CHANGEUISTATE , sent | optional } ,
2007-02-14 11:45:45 +01:00
{ WM_UPDATEUISTATE , sent | optional } ,
2004-05-18 22:44:23 +02:00
{ WM_SHOWWINDOW , sent } ,
2004-06-01 21:39:26 +02:00
{ HCBT_ACTIVATE , hook } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-01-11 11:38:31 +01:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2005-01-06 21:43:34 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOSIZE | SWP_NOMOVE } ,
2009-02-26 14:28:38 +01:00
{ WM_NCACTIVATE , sent } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional } ,
2003-10-02 06:32:56 +02:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2009-02-25 12:25:03 +01:00
{ WM_NCPAINT , sent | optional } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional } ,
2009-02-25 12:25:03 +01:00
{ WM_ERASEBKGND , sent | optional } ,
{ WM_CTLCOLORDLG , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional } ,
2004-05-20 03:17:28 +02:00
{ WM_NCCALCSIZE , sent | optional } ,
{ WM_NCPAINT , sent | optional } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional } ,
2004-05-20 03:17:28 +02:00
{ WM_ERASEBKGND , sent | optional } ,
{ WM_CTLCOLORDLG , sent | optional } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-05-20 03:17:28 +02:00
{ WM_PAINT , sent | optional } ,
2009-03-03 13:20:49 +01:00
{ WM_CTLCOLORBTN , sent | optional } ,
2009-03-09 17:54:16 +01:00
{ WM_GETTITLEBARINFOEX , sent | optional } ,
2004-09-09 00:02:23 +02:00
{ WM_ENTERIDLE , sent | parent | optional } ,
2005-03-14 11:05:50 +01:00
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
{ WM_ENTERIDLE , sent | parent | optional } ,
2004-05-18 22:44:23 +02:00
{ WM_TIMER , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_STATECHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_ENABLE , sent | parent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional } ,
{ HCBT_ACTIVATE , hook } ,
2003-10-02 06:32:56 +02:00
{ WM_NCACTIVATE , sent | wparam , 0 } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional } ,
2003-10-02 06:32:56 +02:00
{ WM_ACTIVATE , sent | wparam , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-05-18 22:44:23 +02:00
{ WM_WINDOWPOSCHANGING , sent | optional } ,
2008-07-31 17:16:22 +02:00
{ WM_WINDOWPOSCHANGED , sent | optional } ,
2004-05-18 22:44:23 +02:00
{ HCBT_SETFOCUS , hook } ,
2004-05-20 03:17:28 +02:00
{ WM_IME_SETCONTEXT , sent | parent | wparam | defwinproc | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-05-20 03:17:28 +02:00
{ WM_SETFOCUS , sent | parent | defwinproc } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_DIALOGEND , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-01 21:39:26 +02:00
{ HCBT_DESTROYWND , hook } ,
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_DESTROY , sent } ,
{ WM_NCDESTROY , sent } ,
{ 0 }
} ;
/* Creation of a modal dialog that is resized inside WM_INITDIALOG (32) */
2004-03-26 00:35:52 +01:00
static const struct message WmCreateModalDialogResizeSeq [ ] = { /* FIXME: add */
2003-10-02 06:32:56 +02:00
/* (inside dialog proc, handling WM_INITDIALOG) */
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_NCCALCSIZE , sent } ,
{ WM_NCACTIVATE , sent | parent | wparam , 0 } ,
{ WM_GETTEXT , sent | defwinproc } ,
{ WM_ACTIVATE , sent | parent | wparam , 0 } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_WINDOWPOSCHANGING , sent | parent } ,
{ WM_NCACTIVATE , sent | wparam , 1 } ,
{ WM_ACTIVATE , sent | wparam , 1 } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2003-10-02 06:32:56 +02:00
/* (setting focus) */
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_NCPAINT , sent } ,
{ WM_GETTEXT , sent | defwinproc } ,
{ WM_ERASEBKGND , sent } ,
{ WM_CTLCOLORDLG , sent | defwinproc } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , 0 } ,
2003-10-02 06:32:56 +02:00
{ WM_PAINT , sent } ,
/* (bunch of WM_CTLCOLOR* for each control) */
{ WM_PAINT , sent | parent } ,
{ WM_ENTERIDLE , sent | parent | wparam , 0 } ,
{ WM_SETCURSOR , sent | parent } ,
{ 0 }
} ;
2004-02-17 21:29:05 +01:00
/* SetMenu for NonVisible windows with size change*/
2004-03-26 00:35:52 +01:00
static const struct message WmSetMenuNonVisibleSizeChangeSeq [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-02-17 21:29:05 +01:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW } ,
2004-04-06 22:09:59 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2005-11-14 12:24:06 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } , /* XP */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* XP sends a duplicate */
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | optional } ,
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } ,
2004-02-17 21:29:05 +01:00
{ 0 }
} ;
/* SetMenu for NonVisible windows with no size change */
2004-03-26 00:35:52 +01:00
static const struct message WmSetMenuNonVisibleNoSizeChangeSeq [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-02-17 21:29:05 +01:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-02-17 21:29:05 +01:00
{ 0 }
} ;
/* SetMenu for Visible windows with size change */
2004-03-26 00:35:52 +01:00
static const struct message WmSetMenuVisibleSizeChangeSeq [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-02-17 21:29:05 +01:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
2009-01-16 12:33:07 +01:00
{ WM_NCPAINT , sent | optional } , /* wparam != 1 */
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0091 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2004-03-26 00:35:52 +01:00
{ WM_ERASEBKGND , sent | optional } ,
{ WM_ACTIVATE , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-04-06 22:09:59 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | optional } ,
2004-05-18 22:44:23 +02:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
2005-09-28 17:13:10 +02:00
{ WM_NCPAINT , sent | optional } , /* wparam != 1 */
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0091 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
2004-05-18 22:44:23 +02:00
{ WM_ERASEBKGND , sent | optional } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* XP sends a duplicate */
2004-02-17 21:29:05 +01:00
{ 0 }
} ;
/* SetMenu for Visible windows with no size change */
2004-03-26 00:35:52 +01:00
static const struct message WmSetMenuVisibleNoSizeChangeSeq [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-02-17 21:29:05 +01:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2009-01-16 12:33:07 +01:00
{ WM_NCPAINT , sent | optional } , /* wparam != 1 */
2004-05-18 22:44:23 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2004-03-26 00:35:52 +01:00
{ WM_ERASEBKGND , sent | optional } ,
{ WM_ACTIVATE , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-02-17 21:29:05 +01:00
{ 0 }
} ;
2004-05-24 21:08:54 +02:00
/* DrawMenuBar for a visible window */
static const struct message WmDrawMenuBarSeq [ ] =
{
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-05-24 21:08:54 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
2009-01-16 12:33:07 +01:00
{ WM_NCPAINT , sent | optional } , /* wparam != 1 */
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0091 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
2004-05-24 21:08:54 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | optional } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-05-24 21:08:54 +02:00
{ 0 }
} ;
2003-10-02 06:32:56 +02:00
2004-04-08 21:07:06 +02:00
static const struct message WmSetRedrawFalseSeq [ ] =
{
{ WM_SETREDRAW , sent | wparam , 0 } ,
{ 0 }
} ;
static const struct message WmSetRedrawTrueSeq [ ] =
{
{ WM_SETREDRAW , sent | wparam , 1 } ,
{ 0 }
} ;
2005-06-07 22:29:09 +02:00
static const struct message WmEnableWindowSeq_1 [ ] =
2004-06-03 02:08:55 +02:00
{
2005-06-07 22:29:09 +02:00
{ WM_CANCELMODE , sent | wparam | lparam , 0 , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_STATECHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2009-05-12 12:09:30 +02:00
{ HCBT_SETFOCUS , hook | optional } ,
{ WM_KILLFOCUS , sent | optional } ,
2005-06-07 22:29:09 +02:00
{ WM_ENABLE , sent | wparam | lparam , FALSE , 0 } ,
{ 0 }
} ;
static const struct message WmEnableWindowSeq_2 [ ] =
{
{ EVENT_OBJECT_STATECHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_ENABLE , sent | wparam | lparam , TRUE , 0 } ,
2004-06-03 02:08:55 +02:00
{ 0 }
} ;
2004-07-09 21:25:26 +02:00
static const struct message WmGetScrollRangeSeq [ ] =
{
{ SBM_GETRANGE , sent } ,
{ 0 }
} ;
static const struct message WmGetScrollInfoSeq [ ] =
{
{ SBM_GETSCROLLINFO , sent } ,
{ 0 }
} ;
static const struct message WmSetScrollRangeSeq [ ] =
{
/* MSDN claims that Windows sends SBM_SETRANGE message, but win2k SP4
sends SBM_SETSCROLLINFO .
*/
{ SBM_SETSCROLLINFO , sent } ,
{ 0 }
} ;
/* SetScrollRange for a window without a non-client area */
2005-01-06 21:43:34 +01:00
static const struct message WmSetScrollRangeHSeq_empty [ ] =
{
{ EVENT_OBJECT_VALUECHANGE , winevent_hook | wparam | lparam , OBJID_HSCROLL , 0 } ,
{ 0 }
} ;
static const struct message WmSetScrollRangeVSeq_empty [ ] =
{
{ EVENT_OBJECT_VALUECHANGE , winevent_hook | wparam | lparam , OBJID_VSCROLL , 0 } ,
{ 0 }
} ;
2004-07-09 21:25:26 +02:00
static const struct message WmSetScrollRangeHVSeq [ ] =
{
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE } ,
2004-07-09 21:25:26 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_VALUECHANGE , winevent_hook | lparam | optional , 0 /*OBJID_HSCROLL or OBJID_VSCROLL*/ , 0 } ,
2004-07-09 21:25:26 +02:00
{ 0 }
} ;
/* SetScrollRange for a window with a non-client area */
static const struct message WmSetScrollRangeHV_NC_Seq [ ] =
{
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE } ,
2004-07-09 21:25:26 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-07-09 21:25:26 +02:00
{ WM_NCPAINT , sent | optional } ,
2008-03-04 20:00:13 +01:00
{ WM_STYLECHANGING , sent | defwinproc | optional } ,
{ WM_STYLECHANGED , sent | defwinproc | optional } ,
{ WM_STYLECHANGING , sent | defwinproc | optional } ,
{ WM_STYLECHANGED , sent | defwinproc | optional } ,
{ WM_STYLECHANGING , sent | defwinproc | optional } ,
{ WM_STYLECHANGED , sent | defwinproc | optional } ,
{ WM_STYLECHANGING , sent | defwinproc | optional } ,
{ WM_STYLECHANGED , sent | defwinproc | optional } ,
2004-07-09 21:25:26 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2004-09-09 00:02:23 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2004-07-09 21:25:26 +02:00
{ WM_ERASEBKGND , sent | optional } ,
{ WM_CTLCOLORDLG , sent | defwinproc | optional } , /* sent to a parent of the dialog */
2009-02-16 11:52:17 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCLIENTMOVE , 0 , SWP_NOCLIENTSIZE } ,
2009-02-26 14:28:38 +01:00
{ WM_SIZE , sent | defwinproc | optional } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_VALUECHANGE , winevent_hook | lparam | optional , 0 /*OBJID_HSCROLL or OBJID_VSCROLL*/ , 0 } ,
2004-09-09 00:02:23 +02:00
{ WM_GETTEXT , sent | optional } ,
{ WM_GETTEXT , sent | optional } ,
{ WM_GETTEXT , sent | optional } ,
{ WM_GETTEXT , sent | optional } ,
2004-07-09 21:25:26 +02:00
{ 0 }
} ;
2005-01-25 12:21:20 +01:00
/* test if we receive the right sequence of messages */
/* after calling ShowWindow( SW_SHOWNA) */
static const struct message WmSHOWNAChildInvisParInvis [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ 0 }
} ;
static const struct message WmSHOWNAChildVisParInvis [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ 0 }
} ;
static const struct message WmSHOWNAChildVisParVis [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
2005-01-25 12:21:20 +01:00
{ 0 }
} ;
static const struct message WmSHOWNAChildInvisParVis [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-03-14 18:15:33 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-01-25 12:21:20 +01:00
{ WM_ERASEBKGND , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOACTIVATE | SWP_NOCLIENTMOVE } ,
2005-01-25 12:21:20 +01:00
{ 0 }
} ;
static const struct message WmSHOWNATopVisible [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
2008-09-22 12:14:56 +02:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
{ WM_WINDOWPOSCHANGED , sent | optional } ,
2005-01-25 12:21:20 +01:00
{ 0 }
} ;
static const struct message WmSHOWNATopInvisible [ ] = {
2008-09-16 16:27:47 +02:00
{ WM_NOTIFYFORMAT , sent | optional } ,
{ WM_QUERYUISTATE , sent | optional } ,
{ WM_WINDOWPOSCHANGING , sent | optional } ,
{ WM_GETMINMAXINFO , sent | optional } ,
{ WM_NCCALCSIZE , sent | optional } ,
{ WM_WINDOWPOSCHANGED , sent | optional } ,
2005-01-25 12:21:20 +01:00
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-03-14 18:15:33 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2009-02-25 12:25:03 +01:00
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
2005-01-25 12:21:20 +01:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-03-14 11:05:50 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } ,
{ WM_NCPAINT , sent | wparam | optional , 1 } ,
{ WM_ERASEBKGND , sent | optional } ,
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2005-01-25 12:21:20 +01:00
{ WM_MOVE , sent } ,
{ 0 }
} ;
2004-07-09 21:25:26 +02:00
2007-02-14 11:45:45 +01:00
static int after_end_dialog , test_def_id ;
2003-10-02 06:32:56 +02:00
static int sequence_cnt , sequence_size ;
2009-01-12 21:03:57 +01:00
static struct recvd_message * sequence ;
2004-12-07 18:34:19 +01:00
static int log_all_parent_messages ;
2008-08-26 16:55:05 +02:00
static int paint_loop_done ;
2003-10-02 06:32:56 +02:00
2007-08-15 14:23:45 +02:00
/* user32 functions */
static HWND ( WINAPI * pGetAncestor ) ( HWND , UINT ) ;
2008-06-20 17:07:33 +02:00
static BOOL ( WINAPI * pGetMenuInfo ) ( HMENU , LPCMENUINFO ) ;
2007-08-15 14:23:45 +02:00
static void ( WINAPI * pNotifyWinEvent ) ( DWORD , HWND , LONG , LONG ) ;
2008-06-20 17:07:33 +02:00
static BOOL ( WINAPI * pSetMenuInfo ) ( HMENU , LPCMENUINFO ) ;
2007-08-15 14:23:45 +02:00
static HWINEVENTHOOK ( WINAPI * pSetWinEventHook ) ( DWORD , DWORD , HMODULE , WINEVENTPROC , DWORD , DWORD , DWORD ) ;
static BOOL ( WINAPI * pTrackMouseEvent ) ( TRACKMOUSEEVENT * ) ;
static BOOL ( WINAPI * pUnhookWinEvent ) ( HWINEVENTHOOK ) ;
2010-09-01 13:58:06 +02:00
static BOOL ( WINAPI * pGetMonitorInfoA ) ( HMONITOR , LPMONITORINFO ) ;
static HMONITOR ( WINAPI * pMonitorFromPoint ) ( POINT , DWORD ) ;
2007-08-15 14:23:45 +02:00
/* kernel32 functions */
static BOOL ( WINAPI * pGetCPInfoExA ) ( UINT , DWORD , LPCPINFOEXA ) ;
2007-06-21 14:38:21 +02:00
static void init_procs ( void )
{
HMODULE user32 = GetModuleHandleA ( " user32.dll " ) ;
2007-08-15 14:23:45 +02:00
HMODULE kernel32 = GetModuleHandleA ( " kernel32.dll " ) ;
2007-06-21 14:38:21 +02:00
2007-08-15 14:23:45 +02:00
# define GET_PROC(dll, func) \
p # # func = ( void * ) GetProcAddress ( dll , # func ) ; \
2007-06-21 14:38:21 +02:00
if ( ! p # # func ) { \
trace ( " GetProcAddress(%s) failed \n " , # func ) ; \
}
2007-08-15 14:23:45 +02:00
GET_PROC ( user32 , GetAncestor )
2008-06-20 17:07:33 +02:00
GET_PROC ( user32 , GetMenuInfo )
2007-08-15 14:23:45 +02:00
GET_PROC ( user32 , NotifyWinEvent )
2008-06-20 17:07:33 +02:00
GET_PROC ( user32 , SetMenuInfo )
2007-08-15 14:23:45 +02:00
GET_PROC ( user32 , SetWinEventHook )
GET_PROC ( user32 , TrackMouseEvent )
GET_PROC ( user32 , UnhookWinEvent )
2010-09-01 13:58:06 +02:00
GET_PROC ( user32 , GetMonitorInfoA )
GET_PROC ( user32 , MonitorFromPoint )
2007-06-21 14:38:21 +02:00
2007-08-15 14:23:45 +02:00
GET_PROC ( kernel32 , GetCPInfoExA )
# undef GET_PROC
2007-06-21 14:38:21 +02:00
}
2009-01-12 21:03:57 +01:00
static const char * get_winpos_flags ( UINT flags )
{
static char buffer [ 300 ] ;
buffer [ 0 ] = 0 ;
# define DUMP(flag) do { if (flags & flag) { strcat( buffer, "|" #flag ); flags &= ~flag; } } while(0)
DUMP ( SWP_SHOWWINDOW ) ;
DUMP ( SWP_HIDEWINDOW ) ;
DUMP ( SWP_NOACTIVATE ) ;
DUMP ( SWP_FRAMECHANGED ) ;
DUMP ( SWP_NOCOPYBITS ) ;
DUMP ( SWP_NOOWNERZORDER ) ;
DUMP ( SWP_NOSENDCHANGING ) ;
DUMP ( SWP_DEFERERASE ) ;
DUMP ( SWP_ASYNCWINDOWPOS ) ;
DUMP ( SWP_NOZORDER ) ;
DUMP ( SWP_NOREDRAW ) ;
DUMP ( SWP_NOSIZE ) ;
DUMP ( SWP_NOMOVE ) ;
DUMP ( SWP_NOCLIENTSIZE ) ;
DUMP ( SWP_NOCLIENTMOVE ) ;
if ( flags ) sprintf ( buffer + strlen ( buffer ) , " |0x%04x " , flags ) ;
return buffer + 1 ;
# undef DUMP
}
2009-05-12 12:09:30 +02:00
static BOOL ignore_message ( UINT message )
{
/* these are always ignored */
return ( message > = 0xc000 | |
message = = WM_GETICON | |
message = = WM_GETOBJECT | |
message = = WM_TIMECHANGE | |
2009-06-18 13:06:33 +02:00
message = = WM_DISPLAYCHANGE | |
2009-12-16 12:28:41 +01:00
message = = WM_DEVICECHANGE | |
message = = WM_DWMNCRENDERINGCHANGED ) ;
2009-05-12 12:09:30 +02:00
}
2009-01-12 21:03:57 +01:00
# define add_message(msg) add_message_(__LINE__,msg);
static void add_message_ ( int line , const struct recvd_message * msg )
2003-10-02 06:32:56 +02:00
{
2009-01-12 21:51:01 +01:00
struct recvd_message * seq ;
2003-10-02 06:32:56 +02:00
if ( ! sequence )
2004-03-26 00:35:52 +01:00
{
sequence_size = 10 ;
2009-01-12 21:03:57 +01:00
sequence = HeapAlloc ( GetProcessHeap ( ) , 0 , sequence_size * sizeof ( * sequence ) ) ;
2004-03-26 00:35:52 +01:00
}
2003-10-02 06:32:56 +02:00
if ( sequence_cnt = = sequence_size )
2004-03-26 00:35:52 +01:00
{
sequence_size * = 2 ;
2009-01-12 21:03:57 +01:00
sequence = HeapReAlloc ( GetProcessHeap ( ) , 0 , sequence , sequence_size * sizeof ( * sequence ) ) ;
2004-03-26 00:35:52 +01:00
}
2003-10-02 06:32:56 +02:00
assert ( sequence ) ;
2004-03-26 00:35:52 +01:00
2009-01-12 21:51:01 +01:00
seq = & sequence [ sequence_cnt ] ;
seq - > hwnd = msg - > hwnd ;
seq - > message = msg - > message ;
seq - > flags = msg - > flags ;
seq - > wParam = msg - > wParam ;
seq - > lParam = msg - > lParam ;
seq - > line = line ;
seq - > descr = msg - > descr ;
seq - > output [ 0 ] = 0 ;
2009-01-12 21:03:57 +01:00
if ( msg - > descr )
{
if ( msg - > flags & hook )
{
static const char * const CBT_code_name [ 10 ] =
{
" HCBT_MOVESIZE " ,
" HCBT_MINMAX " ,
" HCBT_QS " ,
" HCBT_CREATEWND " ,
" HCBT_DESTROYWND " ,
" HCBT_ACTIVATE " ,
" HCBT_CLICKSKIPPED " ,
" HCBT_KEYSKIPPED " ,
" HCBT_SYSCOMMAND " ,
" HCBT_SETFOCUS "
} ;
const char * code_name = ( msg - > message < = HCBT_SETFOCUS ) ? CBT_code_name [ msg - > message ] : " Unknown " ;
2009-03-09 17:49:56 +01:00
sprintf ( seq - > output , " %s: hook %d (%s) wp %08lx lp %08lx " ,
msg - > descr , msg - > message , code_name , msg - > wParam , msg - > lParam ) ;
2009-01-12 21:03:57 +01:00
}
else if ( msg - > flags & winevent_hook )
{
2009-03-09 17:49:56 +01:00
sprintf ( seq - > output , " %s: winevent %p %08x %08lx %08lx " ,
msg - > descr , msg - > hwnd , msg - > message , msg - > wParam , msg - > lParam ) ;
2009-01-12 21:03:57 +01:00
}
else
{
switch ( msg - > message )
{
case WM_WINDOWPOSCHANGING :
case WM_WINDOWPOSCHANGED :
{
WINDOWPOS * winpos = ( WINDOWPOS * ) msg - > lParam ;
2009-03-09 17:49:56 +01:00
sprintf ( seq - > output , " %s: %p WM_WINDOWPOS%s wp %08lx lp %08lx after %p x %d y %d cx %d cy %d flags %s " ,
2009-01-12 21:51:01 +01:00
msg - > descr , msg - > hwnd ,
( msg - > message = = WM_WINDOWPOSCHANGING ) ? " CHANGING " : " CHANGED " ,
msg - > wParam , msg - > lParam , winpos - > hwndInsertAfter ,
winpos - > x , winpos - > y , winpos - > cx , winpos - > cy ,
get_winpos_flags ( winpos - > flags ) ) ;
2009-01-12 21:03:57 +01:00
/* Log only documented flags, win2k uses 0x1000 and 0x2000
* in the high word for internal purposes
*/
2009-01-12 21:51:01 +01:00
seq - > wParam = winpos - > flags & 0xffff ;
2009-01-12 21:03:57 +01:00
/* We are not interested in the flags that don't match under XP and Win9x */
2009-01-12 21:51:01 +01:00
seq - > wParam & = ~ SWP_NOZORDER ;
2009-01-12 21:03:57 +01:00
break ;
}
case WM_DRAWITEM :
{
DRAW_ITEM_STRUCT di ;
DRAWITEMSTRUCT * dis = ( DRAWITEMSTRUCT * ) msg - > lParam ;
2009-03-09 17:49:56 +01:00
sprintf ( seq - > output , " %s: %p WM_DRAWITEM: type %x, ctl_id %x, item_id %x, action %x, state %x " ,
msg - > descr , msg - > hwnd , dis - > CtlType , dis - > CtlID ,
dis - > itemID , dis - > itemAction , dis - > itemState ) ;
2009-01-12 21:03:57 +01:00
2009-03-03 13:20:49 +01:00
di . u . lp = 0 ;
2009-01-12 21:03:57 +01:00
di . u . item . type = dis - > CtlType ;
di . u . item . ctl_id = dis - > CtlID ;
2009-06-18 13:06:33 +02:00
if ( dis - > CtlType = = ODT_LISTBOX | |
dis - > CtlType = = ODT_COMBOBOX | |
dis - > CtlType = = ODT_MENU )
di . u . item . item_id = dis - > itemID ;
2009-01-12 21:03:57 +01:00
di . u . item . action = dis - > itemAction ;
di . u . item . state = dis - > itemState ;
2009-01-12 21:51:01 +01:00
seq - > lParam = di . u . lp ;
2009-01-12 21:03:57 +01:00
break ;
}
default :
if ( msg - > message > = 0xc000 ) return ; /* ignore registered messages */
2009-03-09 17:49:56 +01:00
sprintf ( seq - > output , " %s: %p %04x wp %08lx lp %08lx " ,
msg - > descr , msg - > hwnd , msg - > message , msg - > wParam , msg - > lParam ) ;
2009-01-12 21:03:57 +01:00
}
2009-05-12 12:09:30 +02:00
if ( msg - > flags & ( sent | posted | parent | defwinproc | beginpaint ) )
sprintf ( seq - > output + strlen ( seq - > output ) , " (flags %x) " , msg - > flags ) ;
2009-01-12 21:03:57 +01:00
}
}
2004-03-26 00:35:52 +01:00
sequence_cnt + + ;
2003-10-02 06:32:56 +02:00
}
2006-03-15 12:11:02 +01:00
/* try to make sure pending X events have been processed before continuing */
static void flush_events ( void )
{
MSG msg ;
2008-03-05 16:48:04 +01:00
int diff = 200 ;
2009-01-16 12:33:07 +01:00
int min_timeout = 100 ;
2006-03-15 12:11:02 +01:00
DWORD time = GetTickCount ( ) + diff ;
while ( diff > 0 )
{
2008-03-05 16:48:04 +01:00
if ( MsgWaitForMultipleObjects ( 0 , NULL , FALSE , min_timeout , QS_ALLINPUT ) = = WAIT_TIMEOUT ) break ;
2006-03-15 12:11:02 +01:00
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
diff = time - GetTickCount ( ) ;
}
}
2005-06-21 22:53:13 +02:00
static void flush_sequence ( void )
2003-10-02 06:32:56 +02:00
{
2004-03-27 21:41:43 +01:00
HeapFree ( GetProcessHeap ( ) , 0 , sequence ) ;
2003-10-02 06:32:56 +02:00
sequence = 0 ;
sequence_cnt = sequence_size = 0 ;
}
2009-01-12 21:51:01 +01:00
static void dump_sequence ( const struct message * expected , const char * context , const char * file , int line )
{
const struct recvd_message * actual = sequence ;
2009-01-15 14:45:53 +01:00
unsigned int count = 0 ;
2009-01-12 21:51:01 +01:00
trace_ ( file , line ) ( " Failed sequence %s: \n " , context ) ;
while ( expected - > message & & actual - > message )
{
if ( actual - > output [ 0 ] )
{
if ( expected - > flags & hook )
{
2009-01-15 14:45:53 +01:00
trace_ ( file , line ) ( " %u: expected: hook %04x - actual: %s \n " ,
count , expected - > message , actual - > output ) ;
2009-01-12 21:51:01 +01:00
}
else if ( expected - > flags & winevent_hook )
{
2009-01-15 14:45:53 +01:00
trace_ ( file , line ) ( " %u: expected: winevent %04x - actual: %s \n " ,
count , expected - > message , actual - > output ) ;
2009-01-12 21:51:01 +01:00
}
else
{
2009-01-15 14:45:53 +01:00
trace_ ( file , line ) ( " %u: expected: msg %04x - actual: %s \n " ,
count , expected - > message , actual - > output ) ;
2009-01-12 21:51:01 +01:00
}
}
if ( expected - > message = = actual - > message )
{
2009-01-20 14:02:02 +01:00
if ( ( expected - > flags & defwinproc ) ! = ( actual - > flags & defwinproc ) & &
( expected - > flags & optional ) )
{
/* don't match messages if their defwinproc status differs */
expected + + ;
}
else
{
expected + + ;
actual + + ;
}
2009-01-12 21:51:01 +01:00
}
/* silently drop winevent messages if there is no support for them */
else if ( ( expected - > flags & optional ) | | ( ( expected - > flags & winevent_hook ) & & ! hEvent_hook ) )
expected + + ;
else
{
expected + + ;
actual + + ;
}
2009-01-15 14:45:53 +01:00
count + + ;
2009-01-12 21:51:01 +01:00
}
/* optional trailing messages */
while ( expected - > message & & ( ( expected - > flags & optional ) | |
( ( expected - > flags & winevent_hook ) & & ! hEvent_hook ) ) )
{
2009-01-19 12:36:11 +01:00
trace_ ( file , line ) ( " %u: expected: msg %04x - actual: nothing \n " , count , expected - > message ) ;
2009-01-12 21:51:01 +01:00
expected + + ;
2009-01-19 12:36:11 +01:00
count + + ;
2009-01-12 21:51:01 +01:00
}
2009-01-19 12:36:11 +01:00
if ( expected - > message )
2009-02-21 12:57:23 +01:00
{
2009-01-19 12:36:11 +01:00
trace_ ( file , line ) ( " %u: expected: msg %04x - actual: nothing \n " , count , expected - > message ) ;
2009-02-21 12:57:23 +01:00
return ;
}
while ( actual - > message & & actual - > output [ 0 ] )
{
2009-01-19 12:36:11 +01:00
trace_ ( file , line ) ( " %u: expected: nothing - actual: %s \n " , count , actual - > output ) ;
2009-02-21 12:57:23 +01:00
actual + + ;
count + + ;
}
2009-01-12 21:51:01 +01:00
}
2004-12-20 17:59:26 +01:00
# define ok_sequence( exp, contx, todo) \
ok_sequence_ ( ( exp ) , ( contx ) , ( todo ) , __FILE__ , __LINE__ )
2009-01-12 21:51:01 +01:00
static void ok_sequence_ ( const struct message * expected_list , const char * context , int todo ,
const char * file , int line )
2003-10-02 06:32:56 +02:00
{
2009-01-12 21:03:57 +01:00
static const struct recvd_message end_of_sequence ;
2009-01-12 21:51:01 +01:00
const struct message * expected = expected_list ;
2009-01-12 21:03:57 +01:00
const struct recvd_message * actual ;
2009-01-12 21:51:01 +01:00
int failcount = 0 , dump = 0 ;
2009-01-15 14:45:53 +01:00
unsigned int count = 0 ;
2009-01-12 21:51:01 +01:00
2004-03-26 00:35:52 +01:00
add_message ( & end_of_sequence ) ;
2003-10-02 06:32:56 +02:00
2004-03-27 21:41:43 +01:00
actual = sequence ;
2004-03-26 00:35:52 +01:00
while ( expected - > message & & actual - > message )
2003-10-02 06:32:56 +02:00
{
if ( expected - > message = = actual - > message )
{
if ( expected - > flags & wparam )
2004-09-13 20:03:09 +02:00
{
2009-01-15 15:43:58 +01:00
if ( ( ( expected - > wParam ^ actual - > wParam ) & ~ expected - > wp_mask ) & & todo )
2004-09-13 20:03:09 +02:00
{
todo_wine {
2004-12-20 17:59:26 +01:00
failcount + + ;
2009-01-12 21:51:01 +01:00
if ( strcmp ( winetest_platform , " wine " ) ) dump + + ;
2004-12-20 17:59:26 +01:00
ok_ ( file , line ) ( FALSE ,
2009-01-15 14:45:53 +01:00
" %s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx \n " ,
context , count , expected - > message , expected - > wParam , actual - > wParam ) ;
2004-09-13 20:03:09 +02:00
}
}
else
2009-01-12 21:51:01 +01:00
{
2009-01-15 15:43:58 +01:00
ok_ ( file , line ) ( ( ( expected - > wParam ^ actual - > wParam ) & ~ expected - > wp_mask ) = = 0 ,
2009-01-15 14:45:53 +01:00
" %s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx \n " ,
context , count , expected - > message , expected - > wParam , actual - > wParam ) ;
2009-01-15 15:43:58 +01:00
if ( ( expected - > wParam ^ actual - > wParam ) & ~ expected - > wp_mask ) dump + + ;
2009-01-12 21:51:01 +01:00
}
2004-09-13 20:03:09 +02:00
}
2003-10-02 06:32:56 +02:00
if ( expected - > flags & lparam )
2006-05-16 12:33:19 +02:00
{
2009-01-15 15:43:58 +01:00
if ( ( ( expected - > lParam ^ actual - > lParam ) & ~ expected - > lp_mask ) & & todo )
2006-05-16 12:33:19 +02:00
{
todo_wine {
failcount + + ;
2009-01-12 21:51:01 +01:00
if ( strcmp ( winetest_platform , " wine " ) ) dump + + ;
2006-05-16 12:33:19 +02:00
ok_ ( file , line ) ( FALSE ,
2009-01-15 14:45:53 +01:00
" %s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx \n " ,
context , count , expected - > message , expected - > lParam , actual - > lParam ) ;
2006-05-16 12:33:19 +02:00
}
}
else
2009-01-12 21:51:01 +01:00
{
2009-01-15 15:43:58 +01:00
ok_ ( file , line ) ( ( ( expected - > lParam ^ actual - > lParam ) & ~ expected - > lp_mask ) = = 0 ,
2009-01-15 14:45:53 +01:00
" %s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx \n " ,
context , count , expected - > message , expected - > lParam , actual - > lParam ) ;
2009-01-15 15:43:58 +01:00
if ( ( expected - > lParam ^ actual - > lParam ) & ~ expected - > lp_mask ) dump + + ;
2009-01-12 21:51:01 +01:00
}
2006-05-16 12:33:19 +02:00
}
2009-03-06 10:38:39 +01:00
if ( ( expected - > flags & optional ) & &
( ( expected - > flags ^ actual - > flags ) & ( defwinproc | parent ) ) )
2009-01-19 12:36:11 +01:00
{
2009-03-06 10:38:39 +01:00
/* don't match optional messages if their defwinproc or parent status differs */
2009-01-19 12:36:11 +01:00
expected + + ;
count + + ;
continue ;
}
2006-05-25 14:26:04 +02:00
if ( ( expected - > flags & defwinproc ) ! = ( actual - > flags & defwinproc ) & & todo )
{
todo_wine {
failcount + + ;
2009-01-12 21:51:01 +01:00
if ( strcmp ( winetest_platform , " wine " ) ) dump + + ;
2006-05-25 14:26:04 +02:00
ok_ ( file , line ) ( FALSE ,
2009-01-15 14:45:53 +01:00
" %s: %u: the msg 0x%04x should %shave been sent by DefWindowProc \n " ,
context , count , expected - > message , ( expected - > flags & defwinproc ) ? " " : " NOT " ) ;
2006-05-25 14:26:04 +02:00
}
}
else
2009-01-12 21:51:01 +01:00
{
2006-05-25 14:26:04 +02:00
ok_ ( file , line ) ( ( expected - > flags & defwinproc ) = = ( actual - > flags & defwinproc ) ,
2009-01-15 14:45:53 +01:00
" %s: %u: the msg 0x%04x should %shave been sent by DefWindowProc \n " ,
context , count , expected - > message , ( expected - > flags & defwinproc ) ? " " : " NOT " ) ;
2009-01-12 21:51:01 +01:00
if ( ( expected - > flags & defwinproc ) ! = ( actual - > flags & defwinproc ) ) dump + + ;
}
2004-12-20 17:59:26 +01:00
ok_ ( file , line ) ( ( expected - > flags & beginpaint ) = = ( actual - > flags & beginpaint ) ,
2009-01-15 14:45:53 +01:00
" %s: %u: the msg 0x%04x should %shave been sent by BeginPaint \n " ,
context , count , expected - > message , ( expected - > flags & beginpaint ) ? " " : " NOT " ) ;
2009-01-12 21:51:01 +01:00
if ( ( expected - > flags & beginpaint ) ! = ( actual - > flags & beginpaint ) ) dump + + ;
2004-12-20 17:59:26 +01:00
ok_ ( file , line ) ( ( expected - > flags & ( sent | posted ) ) = = ( actual - > flags & ( sent | posted ) ) ,
2009-01-15 14:45:53 +01:00
" %s: %u: the msg 0x%04x should have been %s \n " ,
context , count , expected - > message , ( expected - > flags & posted ) ? " posted " : " sent " ) ;
2009-01-12 21:51:01 +01:00
if ( ( expected - > flags & ( sent | posted ) ) ! = ( actual - > flags & ( sent | posted ) ) ) dump + + ;
2004-12-20 17:59:26 +01:00
ok_ ( file , line ) ( ( expected - > flags & parent ) = = ( actual - > flags & parent ) ,
2009-01-15 14:45:53 +01:00
" %s: %u: the msg 0x%04x was expected in %s \n " ,
context , count , expected - > message , ( expected - > flags & parent ) ? " parent " : " child " ) ;
2009-01-12 21:51:01 +01:00
if ( ( expected - > flags & parent ) ! = ( actual - > flags & parent ) ) dump + + ;
2004-12-20 17:59:26 +01:00
ok_ ( file , line ) ( ( expected - > flags & hook ) = = ( actual - > flags & hook ) ,
2009-01-15 14:45:53 +01:00
" %s: %u: the msg 0x%04x should have been sent by a hook \n " ,
context , count , expected - > message ) ;
2009-01-12 21:51:01 +01:00
if ( ( expected - > flags & hook ) ! = ( actual - > flags & hook ) ) dump + + ;
2005-01-06 21:43:34 +01:00
ok_ ( file , line ) ( ( expected - > flags & winevent_hook ) = = ( actual - > flags & winevent_hook ) ,
2009-01-15 14:45:53 +01:00
" %s: %u: the msg 0x%04x should have been sent by a winevent hook \n " ,
context , count , expected - > message ) ;
2009-01-12 21:51:01 +01:00
if ( ( expected - > flags & winevent_hook ) ! = ( actual - > flags & winevent_hook ) ) dump + + ;
2003-10-02 06:32:56 +02:00
expected + + ;
actual + + ;
}
2009-01-16 12:33:07 +01:00
/* silently drop hook messages if there is no support for them */
else if ( ( expected - > flags & optional ) | |
( ( expected - > flags & hook ) & & ! hCBT_hook ) | |
( ( expected - > flags & winevent_hook ) & & ! hEvent_hook ) )
2003-10-02 06:32:56 +02:00
expected + + ;
2004-08-25 19:35:06 +02:00
else if ( todo )
2003-10-02 06:32:56 +02:00
{
2004-12-20 17:59:26 +01:00
failcount + + ;
2004-08-25 19:35:06 +02:00
todo_wine {
2009-01-12 21:51:01 +01:00
if ( strcmp ( winetest_platform , " wine " ) ) dump + + ;
2009-01-15 14:45:53 +01:00
ok_ ( file , line ) ( FALSE , " %s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead \n " ,
context , count , expected - > message , actual - > message ) ;
2004-08-25 19:35:06 +02:00
}
2009-01-12 21:51:01 +01:00
goto done ;
2004-08-25 19:35:06 +02:00
}
else
{
2009-01-15 14:45:53 +01:00
ok_ ( file , line ) ( FALSE , " %s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead \n " ,
context , count , expected - > message , actual - > message ) ;
2009-01-12 21:51:01 +01:00
dump + + ;
2004-08-25 19:35:06 +02:00
expected + + ;
actual + + ;
}
2009-01-15 14:45:53 +01:00
count + + ;
2003-10-02 06:32:56 +02:00
}
2004-05-10 21:59:20 +02:00
/* skip all optional trailing messages */
2005-01-06 21:43:34 +01:00
while ( expected - > message & & ( ( expected - > flags & optional ) | |
2009-01-16 12:33:07 +01:00
( ( expected - > flags & hook ) & & ! hCBT_hook ) | |
( ( expected - > flags & winevent_hook ) & & ! hEvent_hook ) ) )
2004-05-10 21:59:20 +02:00
expected + + ;
2004-08-25 19:35:06 +02:00
if ( todo )
{
todo_wine {
2004-12-20 17:59:26 +01:00
if ( expected - > message | | actual - > message ) {
failcount + + ;
2009-01-12 21:51:01 +01:00
if ( strcmp ( winetest_platform , " wine " ) ) dump + + ;
2009-01-15 14:45:53 +01:00
ok_ ( file , line ) ( FALSE , " %s: %u: the msg sequence is not complete: expected %04x - actual %04x \n " ,
context , count , expected - > message , actual - > message ) ;
2004-12-20 17:59:26 +01:00
}
2004-08-25 19:35:06 +02:00
}
}
else
{
if ( expected - > message | | actual - > message )
2009-01-12 21:51:01 +01:00
{
dump + + ;
2009-01-15 14:45:53 +01:00
ok_ ( file , line ) ( FALSE , " %s: %u: the msg sequence is not complete: expected %04x - actual %04x \n " ,
context , count , expected - > message , actual - > message ) ;
2009-01-12 21:51:01 +01:00
}
2004-08-25 19:35:06 +02:00
}
2004-12-20 17:59:26 +01:00
if ( todo & & ! failcount ) /* succeeded yet marked todo */
todo_wine {
2009-01-12 21:51:01 +01:00
if ( ! strcmp ( winetest_platform , " wine " ) ) dump + + ;
2004-12-20 17:59:26 +01:00
ok_ ( file , line ) ( TRUE , " %s: marked \" todo_wine \" but succeeds \n " , context ) ;
}
2004-03-26 00:35:52 +01:00
2009-01-12 21:51:01 +01:00
done :
if ( dump ) dump_sequence ( expected_list , context , file , line ) ;
2003-10-02 06:32:56 +02:00
flush_sequence ( ) ;
}
2008-07-15 01:50:56 +02:00
# define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
2004-06-23 22:51:21 +02:00
/******************************** MDI test **********************************/
/* CreateWindow for MDI frame window, initially visible */
static const struct message WmCreateMDIframeSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_GETMINMAXINFO , sent } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-23 22:51:21 +02:00
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_NOTIFYFORMAT , sent | optional } ,
{ WM_QUERYUISTATE , sent | optional } ,
{ WM_WINDOWPOSCHANGING , sent | optional } ,
{ WM_GETMINMAXINFO , sent | optional } ,
{ WM_NCCALCSIZE , sent | optional } ,
{ WM_WINDOWPOSCHANGED , sent | optional } ,
2004-06-23 22:51:21 +02:00
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-23 22:51:21 +02:00
{ HCBT_ACTIVATE , hook } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-23 22:51:21 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* XP */
{ WM_ACTIVATEAPP , sent | wparam | optional , 1 } , /* Win9x doesn't send it */
2009-02-24 14:58:02 +01:00
{ WM_NCACTIVATE , sent } ,
2005-03-14 11:05:50 +01:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2004-06-23 22:51:21 +02:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* Win9x */
2004-06-23 22:51:21 +02:00
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-06-23 22:51:21 +02:00
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2004-09-13 20:03:09 +02:00
/* Win9x adds SWP_NOZORDER below */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-11-14 12:24:06 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } , /* XP */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-06-23 22:51:21 +02:00
{ WM_MOVE , sent } ,
{ 0 }
} ;
2004-06-30 20:16:08 +02:00
/* DestroyWindow for MDI frame window, initially visible */
static const struct message WmDestroyMDIframeSeq [ ] = {
{ HCBT_DESTROYWND , hook } ,
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_NCACTIVATE , sent | wparam | optional , 0 } , /* Win9x */
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2007-01-07 12:40:46 +01:00
{ WM_NCACTIVATE , sent | wparam | optional , 0 } , /* XP */
2004-06-30 20:16:08 +02:00
{ WM_ACTIVATE , sent | wparam | optional , 0 } , /* Win9x */
{ WM_ACTIVATEAPP , sent | wparam | optional , 0 } , /* Win9x */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_DESTROY , sent } ,
{ WM_NCDESTROY , sent } ,
{ 0 }
} ;
2004-06-23 22:51:21 +02:00
/* CreateWindow for MDI client window, initially visible */
static const struct message WmCreateMDIclientSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
2004-06-30 20:16:08 +02:00
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam | optional , 0 , 0 } ,
2004-06-23 22:51:21 +02:00
{ WM_CREATE , sent } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam | optional , 0 , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-06-23 22:51:21 +02:00
{ WM_MOVE , sent } ,
{ WM_PARENTNOTIFY , sent | wparam , WM_CREATE } , /* in MDI frame */
2004-06-30 20:16:08 +02:00
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-06-30 20:16:08 +02:00
{ 0 }
} ;
2006-04-25 18:06:10 +02:00
/* ShowWindow(SW_SHOW) for MDI client window */
static const struct message WmShowMDIclientSeq [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2006-04-25 18:06:10 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2006-04-25 18:06:10 +02:00
{ 0 }
} ;
/* ShowWindow(SW_HIDE) for MDI client window */
static const struct message WmHideMDIclientSeq [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* win2000 */
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* XP */
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2006-04-25 18:06:10 +02:00
{ 0 }
} ;
2004-06-30 20:16:08 +02:00
/* DestroyWindow for MDI client window, initially visible */
static const struct message WmDestroyMDIclientSeq [ ] = {
{ HCBT_DESTROYWND , hook } ,
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2004-06-30 20:16:08 +02:00
{ WM_PARENTNOTIFY , sent | wparam , WM_DESTROY } , /* in MDI frame */
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_DESTROY , sent } ,
{ WM_NCDESTROY , sent } ,
2004-06-23 22:51:21 +02:00
{ 0 }
} ;
/* CreateWindow for MDI child window, initially visible */
2004-06-30 20:16:08 +02:00
static const struct message WmCreateMDIchildVisibleSeq [ ] = {
2004-06-23 22:51:21 +02:00
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-06-23 22:51:21 +02:00
{ WM_MOVE , sent } ,
2004-06-30 20:16:08 +02:00
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_CREATE , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
{ WM_PARENTNOTIFY , sent /*|wparam, WM_CREATE*/ } , /* in MDI client */
2004-06-23 22:51:21 +02:00
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-06-23 22:51:21 +02:00
{ WM_MDIREFRESHMENU , sent /*|wparam|lparam, 0, 0*/ } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2004-06-23 22:51:21 +02:00
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2004-09-13 20:03:09 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-06-30 20:16:08 +02:00
/* Win9x: message sequence terminates here. */
2004-06-23 22:51:21 +02:00
{ WM_NCACTIVATE , sent | wparam | defwinproc , 1 } ,
{ HCBT_SETFOCUS , hook } , /* in MDI client */
2004-06-30 20:16:08 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | optional , 2 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-06-23 22:51:21 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent } , /* in MDI client */
2004-06-30 20:16:08 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
2004-06-23 22:51:21 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-06-23 22:51:21 +02:00
{ WM_SETFOCUS , sent | defwinproc } ,
{ WM_MDIACTIVATE , sent | defwinproc } ,
{ 0 }
} ;
2006-04-25 18:06:10 +02:00
/* CreateWindow for MDI child window with invisible parent */
static const struct message WmCreateMDIchildInvisibleParentSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_GETMINMAXINFO , sent } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam | optional , 0 , 0 } ,
2006-04-25 18:06:10 +02:00
{ WM_CREATE , sent } ,
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2006-04-25 18:06:10 +02:00
{ WM_MOVE , sent } ,
{ WM_PARENTNOTIFY , sent /*|wparam, WM_CREATE*/ } , /* in MDI client */
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_MDIREFRESHMENU , sent } , /* in MDI client */
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
/* Win9x: message sequence terminates here. */
{ WM_NCACTIVATE , sent | wparam | defwinproc , 1 } ,
{ HCBT_SETFOCUS , hook } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
{ WM_IME_NOTIFY , sent | wparam | optional , 2 } , /* in MDI client */
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent } , /* in MDI client */
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent | defwinproc } ,
{ WM_MDIACTIVATE , sent | defwinproc } ,
{ 0 }
} ;
2004-06-30 20:16:08 +02:00
/* DestroyWindow for MDI child window, initially visible */
static const struct message WmDestroyMDIchildVisibleSeq [ ] = {
{ HCBT_DESTROYWND , hook } ,
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_DESTROY , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2004-06-30 20:16:08 +02:00
{ WM_PARENTNOTIFY , sent /*|wparam, WM_DESTROY*/ } , /* in MDI client */
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-06-30 20:16:08 +02:00
/* { WM_DESTROY, sent }
* Win9x : message sequence terminates here .
*/
{ HCBT_SETFOCUS , hook } , /* set focus to MDI client */
{ WM_KILLFOCUS , sent } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ HCBT_SETFOCUS , hook } , /* MDI client sets focus back to MDI child */
{ WM_KILLFOCUS , sent } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-30 20:16:08 +02:00
{ HCBT_SETFOCUS , hook } , /* set focus to MDI client */
{ WM_KILLFOCUS , sent } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ HCBT_SETFOCUS , hook } , /* MDI client sets focus back to MDI child */
{ WM_KILLFOCUS , sent } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ WM_DESTROY , sent } ,
{ HCBT_SETFOCUS , hook } , /* set focus to MDI client */
{ WM_KILLFOCUS , sent } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ HCBT_SETFOCUS , hook } , /* MDI client sets focus back to MDI child */
{ WM_KILLFOCUS , sent } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ WM_NCDESTROY , sent } ,
{ 0 }
} ;
/* CreateWindow for MDI child window, initially invisible */
static const struct message WmCreateMDIchildInvisibleSeq [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-06-30 20:16:08 +02:00
{ WM_MOVE , sent } ,
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_CREATE , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
{ WM_PARENTNOTIFY , sent /*|wparam, WM_CREATE*/ } , /* in MDI client */
{ 0 }
} ;
/* DestroyWindow for MDI child window, initially invisible */
static const struct message WmDestroyMDIchildInvisibleSeq [ ] = {
{ HCBT_DESTROYWND , hook } ,
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_DESTROY , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2004-06-30 20:16:08 +02:00
{ WM_PARENTNOTIFY , sent /*|wparam, WM_DESTROY*/ } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-06-30 20:16:08 +02:00
{ WM_DESTROY , sent } ,
{ WM_NCDESTROY , sent } ,
2007-01-31 11:39:40 +01:00
/* FIXME: Wine destroys an icon/title window while Windows doesn't */
{ WM_PARENTNOTIFY , sent | wparam | optional , WM_DESTROY } , /* MDI client */
2004-06-30 20:16:08 +02:00
{ 0 }
} ;
2004-09-13 21:16:31 +02:00
/* CreateWindow for the 1st MDI child window, initially visible and maximized */
static const struct message WmCreateMDIchildVisibleMaxSeq1 [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-09-13 21:16:31 +02:00
{ WM_MOVE , sent } ,
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_STATECHANGED } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2004-09-13 21:16:31 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-09-13 21:16:31 +02:00
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_CREATE , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
{ WM_PARENTNOTIFY , sent /*|wparam, WM_CREATE*/ } , /* in MDI client */
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-09-13 21:16:31 +02:00
{ WM_MDIREFRESHMENU , sent /*|wparam|lparam, 0, 0*/ } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2009-02-25 12:25:03 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc | optional , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE , 0 , SWP_FRAMECHANGED } ,
2004-09-13 21:16:31 +02:00
/* Win9x: message sequence terminates here. */
2009-01-16 12:33:07 +01:00
{ WM_NCACTIVATE , sent | wparam | defwinproc | optional , 1 } ,
2009-01-19 12:36:11 +01:00
{ HCBT_SETFOCUS , hook | optional } , /* in MDI client */
2004-09-13 21:16:31 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | optional , 2 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2009-01-16 12:33:07 +01:00
{ WM_SETFOCUS , sent | optional } , /* in MDI client */
2009-01-19 12:36:11 +01:00
{ HCBT_SETFOCUS , hook | optional } ,
2009-01-16 12:33:07 +01:00
{ WM_KILLFOCUS , sent | optional } , /* in MDI client */
2004-09-13 21:16:31 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2009-01-16 12:33:07 +01:00
{ WM_SETFOCUS , sent | defwinproc | optional } ,
{ WM_MDIACTIVATE , sent | defwinproc | optional } ,
2004-09-13 21:16:31 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
2004-09-13 21:16:31 +02:00
{ 0 }
} ;
/* CreateWindow for the 2nd MDI child window, initially visible and maximized */
static const struct message WmCreateMDIchildVisibleMaxSeq2 [ ] = {
/* restore the 1st MDI child */
{ WM_SETREDRAW , sent | wparam , 0 } ,
2006-05-23 11:55:02 +02:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWNORMAL } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2004-09-13 21:16:31 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-09-13 21:16:31 +02:00
{ WM_SETREDRAW , sent | wparam , 1 } , /* in the 1st MDI child */
/* create the 2nd MDI child */
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-09-13 21:16:31 +02:00
{ WM_MOVE , sent } ,
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_STATECHANGED } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2004-09-13 21:16:31 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-09-13 21:16:31 +02:00
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_CREATE , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
{ WM_PARENTNOTIFY , sent /*|wparam, WM_CREATE*/ } , /* in MDI client */
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-09-13 21:16:31 +02:00
{ WM_MDIREFRESHMENU , sent /*|wparam|lparam, 0, 0*/ } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
{ WM_NCACTIVATE , sent | wparam | defwinproc , 0 } , /* in the 1st MDI child */
{ WM_MDIACTIVATE , sent | defwinproc } , /* in the 1st MDI child */
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
/* Win9x: message sequence terminates here. */
{ WM_NCACTIVATE , sent | wparam | defwinproc , 1 } ,
{ HCBT_SETFOCUS , hook } ,
2008-09-16 16:27:47 +02:00
{ WM_KILLFOCUS , sent | defwinproc | optional } , /* in the 1st MDI child */
2004-09-13 21:16:31 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 0 } , /* in the 1st MDI child */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-09-13 21:16:31 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-09-13 21:16:31 +02:00
{ WM_SETFOCUS , sent | defwinproc } ,
{ WM_MDIACTIVATE , sent | defwinproc } ,
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
2004-09-13 21:16:31 +02:00
{ 0 }
} ;
2004-10-09 01:36:18 +02:00
/* WM_MDICREATE MDI child window, initially visible and maximized */
static const struct message WmCreateMDIchildVisibleMaxSeq3 [ ] = {
{ WM_MDICREATE , sent } ,
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-10-09 01:36:18 +02:00
{ WM_MOVE , sent } ,
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_STATECHANGED } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2005-01-06 21:43:34 +01:00
2004-10-09 01:36:18 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-10-09 01:36:18 +02:00
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_CREATE , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
{ WM_PARENTNOTIFY , sent /*|wparam, WM_CREATE*/ } , /* in MDI client */
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_MDIREFRESHMENU , sent /*|wparam|lparam, 0, 0*/ } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
2004-10-09 01:36:18 +02:00
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
/* Win9x: message sequence terminates here. */
{ WM_NCACTIVATE , sent | wparam | defwinproc , 1 } ,
2006-10-16 16:23:34 +02:00
{ WM_SETFOCUS , sent | optional } , /* in MDI client */
2004-10-09 01:36:18 +02:00
{ HCBT_SETFOCUS , hook } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2007-09-25 12:26:57 +02:00
{ WM_IME_NOTIFY , sent | wparam | optional , 2 } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam | optional , OBJID_CLIENT , 0 } ,
2006-10-16 16:23:34 +02:00
{ WM_SETFOCUS , sent | optional } , /* in MDI client */
{ HCBT_SETFOCUS , hook | optional } ,
2004-10-09 01:36:18 +02:00
{ WM_KILLFOCUS , sent } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-10-09 01:36:18 +02:00
{ WM_SETFOCUS , sent | defwinproc } ,
{ WM_MDIACTIVATE , sent | defwinproc } ,
/* in MDI child */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-10-09 01:36:18 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2004-10-09 01:36:18 +02:00
/* in MDI client */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-10-09 01:36:18 +02:00
/* in MDI child */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2004-10-09 01:36:18 +02:00
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | optional } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI client */
2005-11-14 12:24:06 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } , /* XP sends it to MDI frame */
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* XP sends a duplicate */
2005-01-06 21:43:34 +01:00
2004-10-09 01:36:18 +02:00
{ 0 }
} ;
2006-10-16 16:23:34 +02:00
/* CreateWindow for the 1st MDI child window, initially invisible and maximized */
static const struct message WmCreateMDIchildInvisibleMaxSeq4 [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_GETMINMAXINFO , sent } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_CREATE , sent } ,
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2009-01-16 12:33:07 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE , 0 , SWP_NOZORDER } , /* MDI frame */
2008-09-16 16:27:47 +02:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } , /* MDI frame */
2009-01-16 12:33:07 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE , 0 , SWP_NOZORDER } , /* MDI frame */
2006-10-16 16:23:34 +02:00
{ WM_MOVE , sent } ,
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_STATECHANGED } ,
2006-10-16 16:23:34 +02:00
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_STATECHANGED } ,
2006-10-16 16:23:34 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2006-10-16 16:23:34 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2006-10-16 16:23:34 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2006-10-16 16:23:34 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
2007-02-28 12:13:34 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } , /* MDI child */
2006-10-16 16:23:34 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_CREATE , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
{ WM_PARENTNOTIFY , sent /*|wparam, WM_CREATE*/ } , /* in MDI client */
{ 0 }
} ;
2004-09-13 21:16:31 +02:00
/* WM_SYSCOMMAND/SC_CLOSE for the 2nd MDI child window, initially visible and maximized */
static const struct message WmDestroyMDIchildVisibleMaxSeq2 [ ] = {
{ WM_SYSCOMMAND , sent | wparam , SC_CLOSE } ,
{ HCBT_SYSCOMMAND , hook } ,
{ WM_CLOSE , sent | defwinproc } ,
{ WM_MDIDESTROY , sent } , /* in MDI client */
/* bring the 1st MDI child to top */
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOSIZE | SWP_NOMOVE } , /* in the 1st MDI child */
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } , /* in the 2nd MDI child */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_REORDER , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-09-13 21:16:31 +02:00
{ WM_CHILDACTIVATE , sent | defwinproc | wparam | lparam , 0 , 0 } , /* in the 1st MDI child */
{ WM_NCACTIVATE , sent | wparam | defwinproc , 0 } , /* in the 1st MDI child */
{ WM_MDIACTIVATE , sent | defwinproc } , /* in the 1st MDI child */
/* maximize the 1st MDI child */
2006-05-23 11:55:02 +02:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
2004-09-13 21:16:31 +02:00
{ WM_GETMINMAXINFO , sent | defwinproc } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | defwinproc | wparam , 1 } ,
{ WM_CHILDACTIVATE , sent | defwinproc | wparam | lparam , 0 , 0 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2004-09-13 21:16:31 +02:00
/* restore the 2nd MDI child */
{ WM_SETREDRAW , sent | defwinproc | wparam , 0 } ,
2006-05-23 11:55:02 +02:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_NORMALNA } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_STATECHANGED } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | defwinproc | wparam , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
2004-09-13 21:16:31 +02:00
{ WM_SETREDRAW , sent | defwinproc | wparam , 1 } ,
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-13 21:16:31 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-09-13 21:16:31 +02:00
/* bring the 1st MDI child to top */
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_NCACTIVATE , sent | wparam | defwinproc , 1 } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent | defwinproc } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-09-13 21:16:31 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-09-13 21:16:31 +02:00
{ WM_SETFOCUS , sent | defwinproc } ,
{ WM_MDIACTIVATE , sent | defwinproc } ,
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
/* apparently ShowWindow(SW_SHOW) on an MDI client */
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-09-13 21:16:31 +02:00
{ WM_MDIREFRESHMENU , sent } ,
{ HCBT_DESTROYWND , hook } ,
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_DESTROY , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | defwinproc | optional } ,
2004-09-13 21:16:31 +02:00
{ WM_PARENTNOTIFY , sent /*|wparam, WM_DESTROY*/ } , /* in MDI client */
{ WM_SHOWWINDOW , sent | defwinproc | wparam , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-09-13 21:16:31 +02:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-09-13 21:16:31 +02:00
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-09-13 21:16:31 +02:00
{ WM_DESTROY , sent | defwinproc } ,
{ WM_NCDESTROY , sent | defwinproc } ,
{ 0 }
} ;
2004-10-09 01:36:18 +02:00
/* WM_MDIDESTROY for the single MDI child window, initially visible and maximized */
static const struct message WmDestroyMDIchildVisibleMaxSeq1 [ ] = {
{ WM_MDIDESTROY , sent } , /* in MDI client */
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-10-09 01:36:18 +02:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-10-09 01:36:18 +02:00
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-10-09 01:36:18 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-10-09 01:36:18 +02:00
{ WM_SETFOCUS , sent } ,
/* in MDI child */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-10-09 01:36:18 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2004-10-09 01:36:18 +02:00
/* in MDI client */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-10-09 01:36:18 +02:00
/* in MDI child */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2004-10-09 01:36:18 +02:00
/* in MDI child */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam | defwinproc , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-10-09 01:36:18 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam | defwinproc , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2004-10-09 01:36:18 +02:00
/* in MDI client */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2004-10-09 01:36:18 +02:00
/* in MDI child */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam | defwinproc , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI client */
2005-11-14 12:24:06 +01:00
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
2005-11-14 12:24:06 +01:00
{ WM_NCCALCSIZE , sent | wparam | defwinproc | optional , 1 } , /* XP sends it to MDI frame */
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | optional } ,
2005-11-14 12:24:06 +01:00
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI client */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* XP sends a duplicate */
2004-10-09 01:36:18 +02:00
/* in MDI frame */
2008-09-16 16:27:47 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
2008-09-16 16:27:47 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | optional } ,
2004-10-09 01:36:18 +02:00
{ WM_NCACTIVATE , sent | wparam , 0 } ,
{ WM_MDIACTIVATE , sent } ,
2006-05-23 11:55:02 +02:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWNORMAL } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_STATECHANGED } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-10-09 01:36:18 +02:00
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2004-10-09 01:36:18 +02:00
/* in MDI child */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam | defwinproc , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-10-09 01:36:18 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-10-09 01:36:18 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2004-10-09 01:36:18 +02:00
/* in MDI client */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE } ,
2004-10-09 01:36:18 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2005-11-14 12:24:06 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } , /* XP */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI client */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
2005-11-14 12:24:06 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* XP sends a duplicate */
2004-10-09 01:36:18 +02:00
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-10-09 01:36:18 +02:00
{ WM_SETFOCUS , sent } , /* in MDI client */
{ WM_MDIREFRESHMENU , sent } , /* in MDI client */
{ HCBT_DESTROYWND , hook } ,
/* Win2k sends wparam set to
* MAKEWPARAM ( WM_DESTROY , MDI_FIRST_CHILD_ID + nTotalCreated ) ,
* while Win9x doesn ' t bother to set child window id according to
* CLIENTCREATESTRUCT . idFirstChild
*/
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2004-10-09 01:36:18 +02:00
{ WM_PARENTNOTIFY , sent /*|wparam, WM_DESTROY*/ } , /* in MDI client */
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-10-09 01:36:18 +02:00
{ WM_ERASEBKGND , sent | parent | optional } ,
2008-09-24 13:11:26 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2004-10-09 01:36:18 +02:00
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-10-09 01:36:18 +02:00
{ WM_DESTROY , sent } ,
{ WM_NCDESTROY , sent } ,
{ 0 }
} ;
2004-09-21 02:24:22 +02:00
/* ShowWindow(SW_MAXIMIZE) for a not visible MDI child window */
static const struct message WmMaximizeMDIchildInvisibleSeq [ ] = {
2006-05-23 11:55:02 +02:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
2004-09-21 02:24:22 +02:00
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2004-09-21 02:24:22 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-09-21 02:24:22 +02:00
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2008-08-04 23:07:10 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional | defwinproc , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_NCACTIVATE , sent | wparam | optional | defwinproc , 1 } ,
{ HCBT_SETFOCUS , hook | optional } ,
2004-09-21 02:24:22 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2008-08-04 23:07:10 +02:00
{ WM_SETFOCUS , sent | optional } , /* in MDI client */
{ HCBT_SETFOCUS , hook | optional } ,
{ WM_KILLFOCUS , sent | optional } , /* in MDI client */
2004-09-21 02:24:22 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2008-08-04 23:07:10 +02:00
{ WM_SETFOCUS , sent | optional | defwinproc } ,
{ WM_MDIACTIVATE , sent | optional | defwinproc } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2004-09-21 02:24:22 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-21 02:24:22 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-09-21 02:24:22 +02:00
{ 0 }
} ;
2006-10-16 16:23:34 +02:00
/* ShowWindow(SW_MAXIMIZE) for a not visible maximized MDI child window */
static const struct message WmMaximizeMDIchildInvisibleSeq2 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
{ WM_GETMINMAXINFO , sent } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED } ,
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc | optional , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_NCACTIVATE , sent | wparam | defwinproc | optional , 1 } ,
2008-09-19 12:07:18 +02:00
{ HCBT_SETFOCUS , hook | optional } ,
2006-10-16 16:23:34 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } , /* in MDI client */
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_SETFOCUS , sent | optional } , /* in MDI client */
{ HCBT_SETFOCUS , hook | optional } ,
{ WM_KILLFOCUS , sent | optional } , /* in MDI client */
2006-10-16 16:23:34 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } , /* in MDI client */
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_SETFOCUS , sent | defwinproc | optional } ,
{ WM_MDIACTIVATE , sent | defwinproc | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2006-10-16 16:23:34 +02:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
{ 0 }
} ;
2006-04-25 18:06:10 +02:00
/* WM_MDIMAXIMIZE for an MDI child window with invisible parent */
static const struct message WmMaximizeMDIchildInvisibleParentSeq [ ] = {
{ WM_MDIMAXIMIZE , sent } , /* in MDI client */
2006-05-23 11:55:02 +02:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
2006-04-25 18:06:10 +02:00
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2006-04-25 18:06:10 +02:00
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* XP doesn't send it */
2006-04-25 18:06:10 +02:00
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOREDRAW | SWP_STATECHANGED } ,
2006-04-25 18:06:10 +02:00
{ WM_MOVE , sent | defwinproc } ,
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2006-04-25 18:06:10 +02:00
{ WM_NCCALCSIZE , sent | wparam | defwinproc , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2006-05-23 11:55:02 +02:00
{ WM_NCCALCSIZE , sent | wparam | defwinproc | optional , 1 } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI child XP */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI client XP */
2006-04-25 18:06:10 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2006-04-25 18:06:10 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0094 , sent | defwinproc | optional } ,
{ 0x0094 , sent | defwinproc | optional } ,
{ 0x0094 , sent | defwinproc | optional } ,
{ 0x0094 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0091 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2006-04-25 18:06:10 +02:00
{ WM_MOVE , sent | defwinproc } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI frame win2000 */
2006-04-25 18:06:10 +02:00
/* in MDI client */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOACTIVATE } ,
2006-04-25 18:06:10 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE } ,
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
2006-04-25 18:06:10 +02:00
/* in MDI child */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | defwinproc , SWP_NOACTIVATE } ,
2006-04-25 18:06:10 +02:00
{ WM_GETMINMAXINFO , sent | defwinproc } ,
{ WM_NCCALCSIZE , sent | wparam | defwinproc , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | defwinproc , SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTMOVE } ,
2006-04-25 18:06:10 +02:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI child win2000 */
2006-05-23 11:55:02 +02:00
{ WM_NCCALCSIZE , sent | wparam | defwinproc | optional , 1 } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI child XP */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI child XP */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI client XP */
2006-05-23 11:55:02 +02:00
/* in MDI frame */
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | optional } ,
2006-05-23 11:55:02 +02:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } ,
2008-03-04 20:00:13 +01:00
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0093 , sent | defwinproc | optional } ,
{ 0x0091 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
{ 0x0092 , sent | defwinproc | optional } ,
2007-01-31 11:39:40 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI frame XP */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI frame XP */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam | optional , 0 , 0 } , /* MDI child XP */
2006-04-25 18:06:10 +02:00
{ 0 }
} ;
2004-09-21 02:24:22 +02:00
/* ShowWindow(SW_MAXIMIZE) for a visible MDI child window */
static const struct message WmMaximizeMDIchildVisibleSeq [ ] = {
2006-05-23 11:55:02 +02:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_MAXIMIZE } ,
2004-09-21 02:24:22 +02:00
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2004-09-21 02:24:22 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_MAXIMIZED } ,
2004-09-21 02:24:22 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-21 02:24:22 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-09-21 02:24:22 +02:00
{ 0 }
} ;
2007-01-31 11:39:40 +01:00
/* ShowWindow(SW_RESTORE) for a visible maximized MDI child window */
2004-09-21 02:24:22 +02:00
static const struct message WmRestoreMDIchildVisibleSeq [ ] = {
2006-05-23 11:55:02 +02:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_RESTORE } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2004-09-21 02:24:22 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2004-09-21 02:24:22 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-21 02:24:22 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-09-21 02:24:22 +02:00
{ 0 }
} ;
2007-01-31 11:39:40 +01:00
/* ShowWindow(SW_RESTORE) for a visible minimized MDI child window */
static const struct message WmRestoreMDIchildVisibleSeq_2 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_RESTORE } ,
{ WM_QUERYOPEN , sent | wparam | lparam , 0 , 0 } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2007-01-31 11:39:40 +01:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2007-01-31 11:39:40 +01:00
{ WM_MOVE , sent | defwinproc } ,
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
{ EVENT_SYSTEM_MINIMIZEEND , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent } ,
{ 0 }
} ;
/* ShowWindow(SW_MINIMIZE) for a visible restored MDI child window */
static const struct message WmMinimizeMDIchildVisibleSeq [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MINIMIZE } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2007-01-31 11:39:40 +01:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2007-01-31 11:39:40 +01:00
{ WM_MOVE , sent | defwinproc } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | defwinproc | wparam | lparam , SIZE_MINIMIZED , 0 } ,
2007-01-31 11:39:40 +01:00
{ WM_CHILDACTIVATE , sent | wparam | lparam | defwinproc , 0 , 0 } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
{ EVENT_SYSTEM_MINIMIZESTART , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
/* FIXME: Wine creates an icon/title window while Windows doesn't */
{ WM_PARENTNOTIFY , sent | parent | wparam | optional , WM_CREATE } , /* MDI client */
{ 0 }
} ;
2004-09-21 02:24:22 +02:00
/* ShowWindow(SW_RESTORE) for a not visible MDI child window */
static const struct message WmRestoreMDIchildInisibleSeq [ ] = {
2006-05-23 11:55:02 +02:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_RESTORE } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_STATECHANGED } ,
2004-09-21 02:24:22 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-09-21 02:24:22 +02:00
{ WM_CHILDACTIVATE , sent | wparam | lparam , 0 , 0 } ,
2010-02-08 09:53:43 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_STATECHANGED } ,
2007-01-07 12:40:46 +01:00
{ WM_SIZE , sent | defwinproc | wparam , SIZE_RESTORED } ,
2004-09-21 02:24:22 +02:00
/* in MDI frame */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2004-09-21 02:24:22 +02:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI frame */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } , /* MDI child */
2004-09-21 02:24:22 +02:00
{ 0 }
} ;
2004-06-23 22:51:21 +02:00
static HWND mdi_client ;
static WNDPROC old_mdi_client_proc ;
static LRESULT WINAPI mdi_client_hook_proc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-06-23 22:51:21 +02:00
/* do not log painting messages */
if ( message ! = WM_PAINT & &
2007-01-07 12:40:46 +01:00
message ! = WM_NCPAINT & &
message ! = WM_SYNCPAINT & &
2004-06-23 22:51:21 +02:00
message ! = WM_ERASEBKGND & &
2005-01-06 21:43:34 +01:00
message ! = WM_NCHITTEST & &
2004-10-11 21:55:28 +02:00
message ! = WM_GETTEXT & &
2005-02-18 21:01:41 +01:00
message ! = WM_MDIGETACTIVE & &
2009-05-12 12:09:30 +02:00
! ignore_message ( message ) )
2004-06-23 22:51:21 +02:00
{
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2004-06-23 22:51:21 +02:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
2004-06-30 20:16:08 +02:00
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " mdi client " ;
2004-06-23 22:51:21 +02:00
add_message ( & msg ) ;
}
return CallWindowProcA ( old_mdi_client_proc , hwnd , message , wParam , lParam ) ;
}
static LRESULT WINAPI mdi_child_wnd_proc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-04-22 10:25:30 +02:00
static LONG defwndproc_counter = 0 ;
2004-06-23 22:51:21 +02:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-06-23 22:51:21 +02:00
/* do not log painting messages */
if ( message ! = WM_PAINT & &
2007-01-07 12:40:46 +01:00
message ! = WM_NCPAINT & &
message ! = WM_SYNCPAINT & &
2004-06-23 22:51:21 +02:00
message ! = WM_ERASEBKGND & &
2005-01-06 21:43:34 +01:00
message ! = WM_NCHITTEST & &
2005-02-18 21:01:41 +01:00
message ! = WM_GETTEXT & &
2009-05-12 12:09:30 +02:00
! ignore_message ( message ) )
2004-06-23 22:51:21 +02:00
{
2004-06-30 20:16:08 +02:00
switch ( message )
{
2004-10-11 21:55:28 +02:00
case WM_MDIACTIVATE :
{
HWND active , client = GetParent ( hwnd ) ;
active = ( HWND ) SendMessageA ( client , WM_MDIGETACTIVE , 0 , 0 ) ;
if ( hwnd = = ( HWND ) lParam ) /* if we are being activated */
ok ( active = = ( HWND ) lParam , " new active %p != active %p \n " , ( HWND ) lParam , active ) ;
else
ok ( active = = ( HWND ) wParam , " old active %p != active %p \n " , ( HWND ) wParam , active ) ;
break ;
}
2004-06-30 20:16:08 +02:00
}
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2004-06-23 22:51:21 +02:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
if ( defwndproc_counter ) msg . flags | = defwinproc ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " mdi child " ;
2004-06-23 22:51:21 +02:00
add_message ( & msg ) ;
}
defwndproc_counter + + ;
ret = DefMDIChildProcA ( hwnd , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
}
static LRESULT WINAPI mdi_frame_wnd_proc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-04-22 10:25:30 +02:00
static LONG defwndproc_counter = 0 ;
2004-06-23 22:51:21 +02:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-06-23 22:51:21 +02:00
/* do not log painting messages */
if ( message ! = WM_PAINT & &
2007-01-07 12:40:46 +01:00
message ! = WM_NCPAINT & &
message ! = WM_SYNCPAINT & &
2004-06-23 22:51:21 +02:00
message ! = WM_ERASEBKGND & &
2005-01-06 21:43:34 +01:00
message ! = WM_NCHITTEST & &
2005-02-18 21:01:41 +01:00
message ! = WM_GETTEXT & &
2009-05-12 12:09:30 +02:00
! ignore_message ( message ) )
2004-06-23 22:51:21 +02:00
{
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2004-06-23 22:51:21 +02:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
if ( defwndproc_counter ) msg . flags | = defwinproc ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " mdi frame " ;
2004-06-23 22:51:21 +02:00
add_message ( & msg ) ;
}
defwndproc_counter + + ;
ret = DefFrameProcA ( hwnd , mdi_client , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
}
static BOOL mdi_RegisterWindowClasses ( void )
{
WNDCLASSA cls ;
cls . style = 0 ;
cls . lpfnWndProc = mdi_frame_wnd_proc ;
cls . cbClsExtra = 0 ;
cls . cbWndExtra = 0 ;
cls . hInstance = GetModuleHandleA ( 0 ) ;
cls . hIcon = 0 ;
2009-01-13 10:55:46 +01:00
cls . hCursor = LoadCursorA ( 0 , IDC_ARROW ) ;
2004-06-23 22:51:21 +02:00
cls . hbrBackground = GetStockObject ( WHITE_BRUSH ) ;
cls . lpszMenuName = NULL ;
cls . lpszClassName = " MDI_frame_class " ;
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
cls . lpfnWndProc = mdi_child_wnd_proc ;
cls . lpszClassName = " MDI_child_class " ;
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
if ( ! GetClassInfoA ( 0 , " MDIClient " , & cls ) ) assert ( 0 ) ;
old_mdi_client_proc = cls . lpfnWndProc ;
cls . hInstance = GetModuleHandleA ( 0 ) ;
cls . lpfnWndProc = mdi_client_hook_proc ;
cls . lpszClassName = " MDI_client_class " ;
if ( ! RegisterClassA ( & cls ) ) assert ( 0 ) ;
return TRUE ;
}
static void test_mdi_messages ( void )
{
2004-10-05 04:10:04 +02:00
MDICREATESTRUCTA mdi_cs ;
2004-06-23 22:51:21 +02:00
CLIENTCREATESTRUCT client_cs ;
2004-09-13 21:16:31 +02:00
HWND mdi_frame , mdi_child , mdi_child2 , active_child ;
BOOL zoomed ;
2010-02-08 09:53:43 +01:00
RECT rc ;
2004-10-09 01:36:18 +02:00
HMENU hMenu = CreateMenu ( ) ;
2004-06-23 22:51:21 +02:00
assert ( mdi_RegisterWindowClasses ( ) ) ;
flush_sequence ( ) ;
trace ( " creating MDI frame window \n " ) ;
mdi_frame = CreateWindowExA ( 0 , " MDI_frame_class " , " MDI frame window " ,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_VISIBLE ,
100 , 100 , CW_USEDEFAULT , CW_USEDEFAULT ,
2004-10-09 01:36:18 +02:00
GetDesktopWindow ( ) , hMenu ,
2004-06-23 22:51:21 +02:00
GetModuleHandleA ( 0 ) , NULL ) ;
assert ( mdi_frame ) ;
2007-01-07 12:40:46 +01:00
ok_sequence ( WmCreateMDIframeSeq , " Create MDI frame window " , FALSE ) ;
2004-06-23 22:51:21 +02:00
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_frame , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-06-23 22:51:21 +02:00
trace ( " creating MDI client window \n " ) ;
2010-02-08 09:53:43 +01:00
GetClientRect ( mdi_frame , & rc ) ;
2004-06-23 22:51:21 +02:00
client_cs . hWindowMenu = 0 ;
2004-06-30 20:16:08 +02:00
client_cs . idFirstChild = MDI_FIRST_CHILD_ID ;
2004-06-23 22:51:21 +02:00
mdi_client = CreateWindowExA ( 0 , " MDI_client_class " ,
NULL ,
2004-06-30 20:16:08 +02:00
WS_CHILD | WS_VISIBLE | MDIS_ALLCHILDSTYLES ,
2010-02-08 09:53:43 +01:00
rc . left , rc . top , rc . right - rc . left , rc . bottom - rc . top ,
2004-06-23 22:51:21 +02:00
mdi_frame , 0 , GetModuleHandleA ( 0 ) , & client_cs ) ;
assert ( mdi_client ) ;
2004-09-13 20:03:09 +02:00
ok_sequence ( WmCreateMDIclientSeq , " Create visible MDI client window " , FALSE ) ;
2004-06-30 20:16:08 +02:00
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
2004-06-30 20:16:08 +02:00
ok ( GetFocus ( ) = = mdi_frame , " input focus should be on MDI frame not on %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( ! active_child , " wrong active MDI child %p \n " , active_child ) ;
ok ( ! zoomed , " wrong zoomed state %d \n " , zoomed ) ;
2004-06-30 20:16:08 +02:00
SetFocus ( 0 ) ;
flush_sequence ( ) ;
2004-06-23 22:51:21 +02:00
2004-12-06 17:38:19 +01:00
trace ( " creating invisible MDI child window \n " ) ;
mdi_child = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
WS_CHILD ,
0 , 0 , CW_USEDEFAULT , CW_USEDEFAULT ,
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
assert ( mdi_child ) ;
flush_sequence ( ) ;
ShowWindow ( mdi_child , SW_SHOWNORMAL ) ;
ok_sequence ( WmShowChildSeq , " ShowWindow(SW_SHOWNORMAL) MDI child window " , FALSE ) ;
ok ( GetWindowLongA ( mdi_child , GWL_STYLE ) & WS_VISIBLE , " MDI child should be visible \n " ) ;
ok ( IsWindowVisible ( mdi_child ) , " MDI child should be visible \n " ) ;
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( ! active_child , " wrong active MDI child %p \n " , active_child ) ;
ok ( ! zoomed , " wrong zoomed state %d \n " , zoomed ) ;
ShowWindow ( mdi_child , SW_HIDE ) ;
ok_sequence ( WmHideChildSeq , " ShowWindow(SW_HIDE) MDI child window " , FALSE ) ;
flush_sequence ( ) ;
ShowWindow ( mdi_child , SW_SHOW ) ;
ok_sequence ( WmShowChildSeq , " ShowWindow(SW_SHOW) MDI child window " , FALSE ) ;
ok ( GetWindowLongA ( mdi_child , GWL_STYLE ) & WS_VISIBLE , " MDI child should be visible \n " ) ;
ok ( IsWindowVisible ( mdi_child ) , " MDI child should be visible \n " ) ;
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( ! active_child , " wrong active MDI child %p \n " , active_child ) ;
ok ( ! zoomed , " wrong zoomed state %d \n " , zoomed ) ;
DestroyWindow ( mdi_child ) ;
flush_sequence ( ) ;
2004-06-30 20:16:08 +02:00
trace ( " creating visible MDI child window \n " ) ;
2004-06-23 22:51:21 +02:00
mdi_child = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
WS_CHILD | WS_VISIBLE ,
0 , 0 , CW_USEDEFAULT , CW_USEDEFAULT ,
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
assert ( mdi_child ) ;
2005-03-22 17:45:31 +01:00
ok_sequence ( WmCreateMDIchildVisibleSeq , " Create visible MDI child window " , FALSE ) ;
2004-06-30 20:16:08 +02:00
ok ( GetWindowLongA ( mdi_child , GWL_STYLE ) & WS_VISIBLE , " MDI child should be visible \n " ) ;
ok ( IsWindowVisible ( mdi_child ) , " MDI child should be visible \n " ) ;
2004-06-23 22:51:21 +02:00
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child , " wrong active MDI child %p \n " , active_child ) ;
ok ( ! zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
2004-06-23 22:51:21 +02:00
DestroyWindow ( mdi_child ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmDestroyMDIchildVisibleSeq , " Destroy visible MDI child window " , TRUE ) ;
2004-06-30 20:16:08 +02:00
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
/* Win2k: MDI client still returns a just destroyed child as active
* Win9x : MDI client returns 0
*/
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child | | /* win2k */
! active_child , /* win9x */
" wrong active MDI child %p \n " , active_child ) ;
ok ( ! zoomed , " wrong zoomed state %d \n " , zoomed ) ;
2004-06-30 20:16:08 +02:00
flush_sequence ( ) ;
trace ( " creating invisible MDI child window \n " ) ;
2004-09-13 21:16:31 +02:00
mdi_child2 = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
2004-06-30 20:16:08 +02:00
WS_CHILD ,
0 , 0 , CW_USEDEFAULT , CW_USEDEFAULT ,
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
2004-09-13 21:16:31 +02:00
assert ( mdi_child2 ) ;
2004-09-21 02:24:22 +02:00
ok_sequence ( WmCreateMDIchildInvisibleSeq , " Create invisible MDI child window " , FALSE ) ;
2004-06-30 20:16:08 +02:00
2004-09-13 21:16:31 +02:00
ok ( ! ( GetWindowLongA ( mdi_child2 , GWL_STYLE ) & WS_VISIBLE ) , " MDI child should not be visible \n " ) ;
ok ( ! IsWindowVisible ( mdi_child2 ) , " MDI child should not be visible \n " ) ;
2004-06-30 20:16:08 +02:00
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
/* Win2k: MDI client still returns a just destroyed child as active
* Win9x : MDI client returns mdi_child2
*/
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child | | /* win2k */
active_child = = mdi_child2 , /* win9x */
" wrong active MDI child %p \n " , active_child ) ;
ok ( ! zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
2004-09-21 02:24:22 +02:00
ShowWindow ( mdi_child2 , SW_MAXIMIZE ) ;
2007-01-04 15:32:05 +01:00
ok_sequence ( WmMaximizeMDIchildInvisibleSeq , " ShowWindow(SW_MAXIMIZE):invisible MDI child " , FALSE ) ;
2004-09-21 02:24:22 +02:00
ok ( GetWindowLongA ( mdi_child2 , GWL_STYLE ) & WS_VISIBLE , " MDI child should be visible \n " ) ;
ok ( IsWindowVisible ( mdi_child2 ) , " MDI child should be visible \n " ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child2 , " wrong active MDI child %p \n " , active_child ) ;
ok ( zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child2 | | /* win2k */
GetFocus ( ) = = 0 , /* win9x */
" wrong focus window %p \n " , GetFocus ( ) ) ;
SetFocus ( 0 ) ;
flush_sequence ( ) ;
ShowWindow ( mdi_child2 , SW_HIDE ) ;
ok_sequence ( WmHideChildSeq , " ShowWindow(SW_HIDE):MDI child " , FALSE ) ;
ShowWindow ( mdi_child2 , SW_RESTORE ) ;
2007-01-04 15:32:05 +01:00
ok_sequence ( WmRestoreMDIchildInisibleSeq , " ShowWindow(SW_RESTORE):invisible MDI child " , FALSE ) ;
2004-09-21 02:24:22 +02:00
flush_sequence ( ) ;
ok ( GetWindowLongA ( mdi_child2 , GWL_STYLE ) & WS_VISIBLE , " MDI child should be visible \n " ) ;
ok ( IsWindowVisible ( mdi_child2 ) , " MDI child should be visible \n " ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child2 , " wrong active MDI child %p \n " , active_child ) ;
ok ( ! zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
SetFocus ( 0 ) ;
flush_sequence ( ) ;
ShowWindow ( mdi_child2 , SW_HIDE ) ;
ok_sequence ( WmHideChildSeq , " ShowWindow(SW_HIDE):MDI child " , FALSE ) ;
2004-09-13 21:16:31 +02:00
ShowWindow ( mdi_child2 , SW_SHOW ) ;
2004-12-20 17:59:26 +01:00
ok_sequence ( WmShowChildSeq , " ShowWindow(SW_SHOW):MDI child " , FALSE ) ;
2004-09-13 21:16:31 +02:00
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
ShowWindow ( mdi_child2 , SW_MAXIMIZE ) ;
2007-01-04 15:32:05 +01:00
ok_sequence ( WmMaximizeMDIchildVisibleSeq , " ShowWindow(SW_MAXIMIZE):MDI child " , FALSE ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
ShowWindow ( mdi_child2 , SW_RESTORE ) ;
2007-01-31 11:39:40 +01:00
ok_sequence ( WmRestoreMDIchildVisibleSeq , " ShowWindow(SW_RESTORE):maximized MDI child " , FALSE ) ;
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
ShowWindow ( mdi_child2 , SW_MINIMIZE ) ;
ok_sequence ( WmMinimizeMDIchildVisibleSeq , " ShowWindow(SW_MINIMIZE):MDI child " , TRUE ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
2007-01-31 11:39:40 +01:00
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child2 , " wrong active MDI child %p \n " , active_child ) ;
ok ( ! zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
ShowWindow ( mdi_child2 , SW_RESTORE ) ;
2010-02-08 09:53:43 +01:00
ok_sequence ( WmRestoreMDIchildVisibleSeq_2 , " ShowWindow(SW_RESTORE):minimized MDI child " , FALSE ) ;
2007-01-31 11:39:40 +01:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child2 , " wrong focus window %p \n " , GetFocus ( ) ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child2 , " wrong active MDI child %p \n " , active_child ) ;
ok ( ! zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
2004-09-21 02:24:22 +02:00
SetFocus ( 0 ) ;
flush_sequence ( ) ;
2004-09-13 21:16:31 +02:00
ShowWindow ( mdi_child2 , SW_HIDE ) ;
ok_sequence ( WmHideChildSeq , " ShowWindow(SW_HIDE):MDI child " , FALSE ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
DestroyWindow ( mdi_child2 ) ;
2004-12-20 17:59:26 +01:00
ok_sequence ( WmDestroyMDIchildInvisibleSeq , " Destroy invisible MDI child window " , FALSE ) ;
2004-06-30 20:16:08 +02:00
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
/* test for maximized MDI children */
trace ( " creating maximized visible MDI child window 1 \n " ) ;
mdi_child = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX | WS_MAXIMIZE ,
0 , 0 , CW_USEDEFAULT , CW_USEDEFAULT ,
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
assert ( mdi_child ) ;
ok_sequence ( WmCreateMDIchildVisibleMaxSeq1 , " Create maximized visible 1st MDI child window " , TRUE ) ;
ok ( IsZoomed ( mdi_child ) , " 1st MDI child should be maximized \n " ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child | | /* win2k */
GetFocus ( ) = = 0 , /* win9x */
" wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child , " wrong active MDI child %p \n " , active_child ) ;
ok ( zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
trace ( " creating maximized visible MDI child window 2 \n " ) ;
mdi_child2 = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX | WS_MAXIMIZE ,
0 , 0 , CW_USEDEFAULT , CW_USEDEFAULT ,
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
assert ( mdi_child2 ) ;
ok_sequence ( WmCreateMDIchildVisibleMaxSeq2 , " Create maximized visible 2nd MDI child 2 window " , TRUE ) ;
ok ( IsZoomed ( mdi_child2 ) , " 2nd MDI child should be maximized \n " ) ;
ok ( ! IsZoomed ( mdi_child ) , " 1st MDI child should NOT be maximized \n " ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child2 , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child2 , " wrong active MDI child %p \n " , active_child ) ;
ok ( zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
2004-09-21 02:24:22 +02:00
trace ( " destroying maximized visible MDI child window 2 \n " ) ;
2004-09-13 21:16:31 +02:00
DestroyWindow ( mdi_child2 ) ;
ok_sequence ( WmDestroyMDIchildVisibleSeq , " Destroy visible MDI child window " , TRUE ) ;
ok ( ! IsZoomed ( mdi_child ) , " 1st MDI child should NOT be maximized \n " ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
/* Win2k: MDI client still returns a just destroyed child as active
* Win9x : MDI client returns 0
*/
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child2 | | /* win2k */
! active_child , /* win9x */
" wrong active MDI child %p \n " , active_child ) ;
flush_sequence ( ) ;
ShowWindow ( mdi_child , SW_MAXIMIZE ) ;
ok ( IsZoomed ( mdi_child ) , " 1st MDI child should be maximized \n " ) ;
flush_sequence ( ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
trace ( " re-creating maximized visible MDI child window 2 \n " ) ;
mdi_child2 = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX | WS_MAXIMIZE ,
0 , 0 , CW_USEDEFAULT , CW_USEDEFAULT ,
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
assert ( mdi_child2 ) ;
ok_sequence ( WmCreateMDIchildVisibleMaxSeq2 , " Create maximized visible 2nd MDI child 2 window " , TRUE ) ;
ok ( IsZoomed ( mdi_child2 ) , " 2nd MDI child should be maximized \n " ) ;
ok ( ! IsZoomed ( mdi_child ) , " 1st MDI child should NOT be maximized \n " ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child2 , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child2 , " wrong active MDI child %p \n " , active_child ) ;
ok ( zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
SendMessageA ( mdi_child2 , WM_SYSCOMMAND , SC_CLOSE , 0 ) ;
ok_sequence ( WmDestroyMDIchildVisibleMaxSeq2 , " WM_SYSCOMMAND/SC_CLOSE on a visible maximized MDI child window " , TRUE ) ;
ok ( ! IsWindow ( mdi_child2 ) , " MDI child 2 should be destroyed \n " ) ;
ok ( IsZoomed ( mdi_child ) , " 1st MDI child should be maximized \n " ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child , " wrong active MDI child %p \n " , active_child ) ;
ok ( zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
DestroyWindow ( mdi_child ) ;
ok_sequence ( WmDestroyMDIchildVisibleSeq , " Destroy visible MDI child window " , TRUE ) ;
2004-09-21 02:24:22 +02:00
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = 0 , " wrong focus window %p \n " , GetFocus ( ) ) ;
2004-09-13 21:16:31 +02:00
/* Win2k: MDI client still returns a just destroyed child as active
* Win9x : MDI client returns 0
*/
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child | | /* win2k */
! active_child , /* win9x */
" wrong active MDI child %p \n " , active_child ) ;
flush_sequence ( ) ;
2006-10-16 16:23:34 +02:00
trace ( " creating maximized invisible MDI child window \n " ) ;
mdi_child2 = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
WS_CHILD | WS_MAXIMIZE | WS_CAPTION | WS_THICKFRAME ,
0 , 0 , CW_USEDEFAULT , CW_USEDEFAULT ,
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
assert ( mdi_child2 ) ;
2008-07-15 01:51:15 +02:00
ok_sequence ( WmCreateMDIchildInvisibleMaxSeq4 , " Create maximized invisible MDI child window " , FALSE ) ;
2006-10-16 16:23:34 +02:00
ok ( IsZoomed ( mdi_child2 ) , " MDI child should be maximized \n " ) ;
ok ( ! ( GetWindowLongA ( mdi_child2 , GWL_STYLE ) & WS_VISIBLE ) , " MDI child should be not visible \n " ) ;
ok ( ! IsWindowVisible ( mdi_child2 ) , " MDI child should be not visible \n " ) ;
/* Win2k: MDI client still returns a just destroyed child as active
* Win9x : MDI client returns 0
*/
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child | | /* win2k */
2009-03-03 13:20:49 +01:00
! active_child | | active_child = = mdi_child2 , /* win9x */
2006-10-16 16:23:34 +02:00
" wrong active MDI child %p \n " , active_child ) ;
flush_sequence ( ) ;
trace ( " call ShowWindow(mdi_child, SW_MAXIMIZE) \n " ) ;
ShowWindow ( mdi_child2 , SW_MAXIMIZE ) ;
2006-12-19 12:35:42 +01:00
ok_sequence ( WmMaximizeMDIchildInvisibleSeq2 , " ShowWindow(SW_MAXIMIZE):invisible maximized MDI child " , FALSE ) ;
2006-10-16 16:23:34 +02:00
ok ( IsZoomed ( mdi_child2 ) , " MDI child should be maximized \n " ) ;
ok ( GetWindowLongA ( mdi_child2 , GWL_STYLE ) & WS_VISIBLE , " MDI child should be visible \n " ) ;
ok ( IsWindowVisible ( mdi_child2 ) , " MDI child should be visible \n " ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child2 , " wrong active MDI child %p \n " , active_child ) ;
ok ( zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
SendMessageA ( mdi_client , WM_MDIDESTROY , ( WPARAM ) mdi_child2 , 0 ) ;
flush_sequence ( ) ;
2004-09-13 21:16:31 +02:00
/* end of test for maximized MDI children */
2007-09-21 16:37:46 +02:00
SetFocus ( 0 ) ;
flush_sequence ( ) ;
trace ( " creating maximized visible MDI child window 1(Switch test) \n " ) ;
mdi_child = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX | WS_MAXIMIZE ,
0 , 0 , CW_USEDEFAULT , CW_USEDEFAULT ,
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
assert ( mdi_child ) ;
ok_sequence ( WmCreateMDIchildVisibleMaxSeq1 , " Create maximized visible 1st MDI child window(Switch test) " , TRUE ) ;
ok ( IsZoomed ( mdi_child ) , " 1st MDI child should be maximized(Switch test) \n " ) ;
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p(Switch test) \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child | | /* win2k */
GetFocus ( ) = = 0 , /* win9x */
" wrong focus window %p(Switch test) \n " , GetFocus ( ) ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child , " wrong active MDI child %p(Switch test) \n " , active_child ) ;
ok ( zoomed , " wrong zoomed state %d(Switch test) \n " , zoomed ) ;
flush_sequence ( ) ;
trace ( " creating maximized visible MDI child window 2(Switch test) \n " ) ;
mdi_child2 = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX | WS_MAXIMIZE ,
0 , 0 , CW_USEDEFAULT , CW_USEDEFAULT ,
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
assert ( mdi_child2 ) ;
2007-09-25 12:26:57 +02:00
ok_sequence ( WmCreateMDIchildVisibleMaxSeq2 , " Create maximized visible 2nd MDI child window (Switch test) " , TRUE ) ;
2007-09-21 16:37:46 +02:00
ok ( IsZoomed ( mdi_child2 ) , " 2nd MDI child should be maximized(Switch test) \n " ) ;
ok ( ! IsZoomed ( mdi_child ) , " 1st MDI child should NOT be maximized(Switch test) \n " ) ;
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p(Switch test) \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child2 , " wrong focus window %p(Switch test) \n " , GetFocus ( ) ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child2 , " wrong active MDI child %p(Switch test) \n " , active_child ) ;
ok ( zoomed , " wrong zoomed state %d(Switch test) \n " , zoomed ) ;
flush_sequence ( ) ;
trace ( " Switch child window. \n " ) ;
SendMessageA ( mdi_client , WM_MDIACTIVATE , ( WPARAM ) mdi_child , 0 ) ;
2007-09-25 12:26:57 +02:00
ok_sequence ( WmSwitchChild , " Child did not switch correctly " , TRUE ) ;
2007-09-21 16:37:46 +02:00
trace ( " end of test for switch maximized MDI children \n " ) ;
2008-04-17 19:27:25 +02:00
flush_sequence ( ) ;
/* Prepare for switching test of not maximized MDI children */
ShowWindow ( mdi_child , SW_NORMAL ) ;
ok ( ! IsZoomed ( mdi_child ) , " wrong zoomed state for %p(Switch test) \n " , mdi_child ) ;
ok ( ! IsZoomed ( mdi_child2 ) , " wrong zoomed state for %p(Switch test) \n " , mdi_child2 ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , 0 ) ;
ok ( active_child = = mdi_child , " wrong active MDI child %p(Switch test) \n " , active_child ) ;
flush_sequence ( ) ;
SendMessageA ( mdi_client , WM_MDIACTIVATE , ( WPARAM ) mdi_child2 , 0 ) ;
2008-04-26 05:07:39 +02:00
ok_sequence ( WmSwitchNotMaximizedChild , " Not maximized child did not switch correctly " , FALSE ) ;
2008-04-17 19:27:25 +02:00
trace ( " end of test for switch not maximized MDI children \n " ) ;
flush_sequence ( ) ;
2007-09-21 16:37:46 +02:00
SendMessageA ( mdi_client , WM_MDIDESTROY , ( WPARAM ) mdi_child , 0 ) ;
flush_sequence ( ) ;
SendMessageA ( mdi_client , WM_MDIDESTROY , ( WPARAM ) mdi_child2 , 0 ) ;
flush_sequence ( ) ;
SetFocus ( 0 ) ;
flush_sequence ( ) ;
2008-04-17 19:27:25 +02:00
/* end of tests for switch maximized/not maximized MDI children */
2004-09-13 21:16:31 +02:00
2004-10-05 04:10:04 +02:00
mdi_cs . szClass = " MDI_child_Class " ;
mdi_cs . szTitle = " MDI child " ;
mdi_cs . hOwner = GetModuleHandleA ( 0 ) ;
2004-10-09 01:36:18 +02:00
mdi_cs . x = 0 ;
mdi_cs . y = 0 ;
2004-10-05 04:10:04 +02:00
mdi_cs . cx = CW_USEDEFAULT ;
mdi_cs . cy = CW_USEDEFAULT ;
2004-10-09 01:36:18 +02:00
mdi_cs . style = WS_CHILD | WS_SYSMENU | WS_VISIBLE | WS_MAXIMIZEBOX | WS_MAXIMIZE ;
2004-10-05 04:10:04 +02:00
mdi_cs . lParam = 0 ;
mdi_child = ( HWND ) SendMessageA ( mdi_client , WM_MDICREATE , 0 , ( LPARAM ) & mdi_cs ) ;
ok ( mdi_child ! = 0 , " MDI child creation failed \n " ) ;
2004-10-09 01:36:18 +02:00
ok_sequence ( WmCreateMDIchildVisibleMaxSeq3 , " WM_MDICREATE for maximized visible MDI child window " , TRUE ) ;
ok ( GetMenuItemID ( hMenu , GetMenuItemCount ( hMenu ) - 1 ) = = SC_CLOSE , " SC_CLOSE menu item not found \n " ) ;
2004-10-05 04:10:04 +02:00
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child , " wrong active MDI child %p \n " , active_child ) ;
2004-10-09 01:36:18 +02:00
ok ( IsZoomed ( mdi_child ) , " MDI child should be maximized \n " ) ;
ok ( GetActiveWindow ( ) = = mdi_frame , " wrong active window %p \n " , GetActiveWindow ( ) ) ;
ok ( GetFocus ( ) = = mdi_child , " wrong focus window %p \n " , GetFocus ( ) ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( active_child = = mdi_child , " wrong active MDI child %p \n " , active_child ) ;
ok ( zoomed , " wrong zoomed state %d \n " , zoomed ) ;
flush_sequence ( ) ;
2004-10-05 04:10:04 +02:00
SendMessageA ( mdi_client , WM_MDIDESTROY , ( WPARAM ) mdi_child , 0 ) ;
2004-10-09 01:36:18 +02:00
ok_sequence ( WmDestroyMDIchildVisibleMaxSeq1 , " Destroy visible maximized MDI child window " , TRUE ) ;
2004-10-05 04:10:04 +02:00
ok ( ! IsWindow ( mdi_child ) , " MDI child should be destroyed \n " ) ;
active_child = ( HWND ) SendMessageA ( mdi_client , WM_MDIGETACTIVE , 0 , ( LPARAM ) & zoomed ) ;
ok ( ! active_child , " wrong active MDI child %p \n " , active_child ) ;
SetFocus ( 0 ) ;
flush_sequence ( ) ;
2004-06-30 20:16:08 +02:00
DestroyWindow ( mdi_client ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmDestroyMDIclientSeq , " Destroy MDI client window " , FALSE ) ;
2004-06-30 20:16:08 +02:00
2006-04-25 18:06:10 +02:00
/* test maximization of MDI child with invisible parent */
client_cs . hWindowMenu = 0 ;
mdi_client = CreateWindow ( " MDI_client_class " ,
NULL ,
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE ,
2007-01-04 15:32:05 +01:00
0 , 0 , 660 , 430 ,
2006-04-25 18:06:10 +02:00
mdi_frame , 0 , GetModuleHandleA ( 0 ) , & client_cs ) ;
ok_sequence ( WmCreateMDIclientSeq , " Create MDI client window " , FALSE ) ;
ShowWindow ( mdi_client , SW_HIDE ) ;
ok_sequence ( WmHideMDIclientSeq , " Hide MDI client window " , FALSE ) ;
mdi_child = CreateWindowExA ( WS_EX_MDICHILD , " MDI_child_class " , " MDI child " ,
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL ,
2007-01-04 15:32:05 +01:00
0 , 0 , 650 , 440 ,
2006-04-25 18:06:10 +02:00
mdi_client , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
ok_sequence ( WmCreateMDIchildInvisibleParentSeq , " Create MDI child window with invisible parent " , FALSE ) ;
SendMessage ( mdi_client , WM_MDIMAXIMIZE , ( WPARAM ) mdi_child , 0 ) ;
ok_sequence ( WmMaximizeMDIchildInvisibleParentSeq , " Maximize MDI child window with invisible parent " , TRUE ) ;
zoomed = IsZoomed ( mdi_child ) ;
ok ( zoomed , " wrong zoomed state %d \n " , zoomed ) ;
ShowWindow ( mdi_client , SW_SHOW ) ;
ok_sequence ( WmShowMDIclientSeq , " Show MDI client window " , FALSE ) ;
DestroyWindow ( mdi_child ) ;
ok_sequence ( WmDestroyMDIchildVisibleSeq , " Destroy visible maximized MDI child window " , TRUE ) ;
/* end of test for maximization of MDI child with invisible parent */
2007-06-06 14:01:59 +02:00
DestroyWindow ( mdi_client ) ;
ok_sequence ( WmDestroyMDIclientSeq , " Destroy MDI client window " , FALSE ) ;
2004-06-23 22:51:21 +02:00
DestroyWindow ( mdi_frame ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmDestroyMDIframeSeq , " Destroy MDI frame window " , FALSE ) ;
2004-06-23 22:51:21 +02:00
}
/************************* End of MDI test **********************************/
2004-04-08 21:07:06 +02:00
static void test_WM_SETREDRAW ( HWND hwnd )
{
DWORD style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2004-04-08 21:07:06 +02:00
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_SETREDRAW , FALSE , 0 ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmSetRedrawFalseSeq , " SetRedraw:FALSE " , FALSE ) ;
2004-04-08 21:07:06 +02:00
ok ( ! ( GetWindowLongA ( hwnd , GWL_STYLE ) & WS_VISIBLE ) , " WS_VISIBLE should NOT be set \n " ) ;
ok ( ! IsWindowVisible ( hwnd ) , " IsWindowVisible() should return FALSE \n " ) ;
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_SETREDRAW , TRUE , 0 ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmSetRedrawTrueSeq , " SetRedraw:TRUE " , FALSE ) ;
2004-04-08 21:07:06 +02:00
ok ( GetWindowLongA ( hwnd , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
2004-05-05 03:35:37 +02:00
ok ( IsWindowVisible ( hwnd ) , " IsWindowVisible() should return TRUE \n " ) ;
2004-04-08 21:07:06 +02:00
/* restore original WS_VISIBLE state */
SetWindowLongA ( hwnd , GWL_STYLE , style ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2004-04-08 21:07:06 +02:00
flush_sequence ( ) ;
}
2004-05-18 22:44:23 +02:00
static INT_PTR CALLBACK TestModalDlgProcA ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2008-09-15 11:29:58 +02:00
2009-05-12 12:09:30 +02:00
if ( ignore_message ( message ) ) return 0 ;
2005-01-06 21:43:34 +01:00
switch ( message )
{
2006-10-28 10:24:13 +02:00
/* ignore */
case WM_MOUSEMOVE :
2009-01-25 17:29:05 +01:00
case WM_NCMOUSEMOVE :
case WM_NCMOUSELEAVE :
2006-10-28 10:24:13 +02:00
case WM_SETCURSOR :
return 0 ;
2007-01-07 12:40:46 +01:00
case WM_NCHITTEST :
return HTCLIENT ;
2005-01-06 21:43:34 +01:00
}
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2004-05-18 22:44:23 +02:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " dialog " ;
2004-05-18 22:44:23 +02:00
add_message ( & msg ) ;
if ( message = = WM_INITDIALOG ) SetTimer ( hwnd , 1 , 100 , NULL ) ;
if ( message = = WM_TIMER ) EndDialog ( hwnd , 0 ) ;
return 0 ;
}
2004-07-09 21:25:26 +02:00
static void test_hv_scroll_1 ( HWND hwnd , INT ctl , DWORD clear , DWORD set , INT min , INT max )
{
DWORD style , exstyle ;
INT xmin , xmax ;
2004-12-27 18:26:37 +01:00
BOOL ret ;
2004-07-09 21:25:26 +02:00
exstyle = GetWindowLongA ( hwnd , GWL_EXSTYLE ) ;
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
/* do not be confused by WS_DLGFRAME set */
if ( ( style & WS_CAPTION ) = = WS_CAPTION ) style & = ~ WS_CAPTION ;
2006-10-07 21:45:11 +02:00
if ( clear ) ok ( style & clear , " style %08x should be set \n " , clear ) ;
if ( set ) ok ( ! ( style & set ) , " style %08x should not be set \n " , set ) ;
2004-07-09 21:25:26 +02:00
2004-12-27 18:26:37 +01:00
ret = SetScrollRange ( hwnd , ctl , min , max , FALSE ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " SetScrollRange(%d) error %d \n " , ctl , GetLastError ( ) ) ;
2004-07-09 21:25:26 +02:00
if ( ( style & ( WS_DLGFRAME | WS_BORDER | WS_THICKFRAME ) ) | | ( exstyle & WS_EX_DLGMODALFRAME ) )
2004-08-25 19:35:06 +02:00
ok_sequence ( WmSetScrollRangeHV_NC_Seq , " SetScrollRange(SB_HORZ/SB_VERT) NC " , FALSE ) ;
2004-07-09 21:25:26 +02:00
else
2004-12-20 17:59:26 +01:00
ok_sequence ( WmSetScrollRangeHVSeq , " SetScrollRange(SB_HORZ/SB_VERT) " , FALSE ) ;
2004-07-09 21:25:26 +02:00
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
2006-10-07 21:45:11 +02:00
if ( set ) ok ( style & set , " style %08x should be set \n " , set ) ;
if ( clear ) ok ( ! ( style & clear ) , " style %08x should not be set \n " , clear ) ;
2004-07-09 21:25:26 +02:00
/* a subsequent call should do nothing */
2004-12-27 18:26:37 +01:00
ret = SetScrollRange ( hwnd , ctl , min , max , FALSE ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " SetScrollRange(%d) error %d \n " , ctl , GetLastError ( ) ) ;
2005-01-06 21:43:34 +01:00
ok_sequence ( WmEmptySeq , " SetScrollRange(SB_HORZ/SB_VERT) empty sequence " , FALSE ) ;
2004-07-09 21:25:26 +02:00
xmin = 0xdeadbeef ;
xmax = 0xdeadbeef ;
2004-12-27 18:26:37 +01:00
ret = GetScrollRange ( hwnd , ctl , & xmin , & xmax ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " GetScrollRange(%d) error %d \n " , ctl , GetLastError ( ) ) ;
2005-01-06 21:43:34 +01:00
ok_sequence ( WmEmptySeq , " GetScrollRange(SB_HORZ/SB_VERT) empty sequence " , FALSE ) ;
2004-07-09 21:25:26 +02:00
ok ( xmin = = min , " unexpected min scroll value %d \n " , xmin ) ;
ok ( xmax = = max , " unexpected max scroll value %d \n " , xmax ) ;
}
static void test_hv_scroll_2 ( HWND hwnd , INT ctl , DWORD clear , DWORD set , INT min , INT max )
{
DWORD style , exstyle ;
SCROLLINFO si ;
2004-12-27 18:26:37 +01:00
BOOL ret ;
2004-07-09 21:25:26 +02:00
exstyle = GetWindowLongA ( hwnd , GWL_EXSTYLE ) ;
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
/* do not be confused by WS_DLGFRAME set */
if ( ( style & WS_CAPTION ) = = WS_CAPTION ) style & = ~ WS_CAPTION ;
2006-10-07 21:45:11 +02:00
if ( clear ) ok ( style & clear , " style %08x should be set \n " , clear ) ;
if ( set ) ok ( ! ( style & set ) , " style %08x should not be set \n " , set ) ;
2004-07-09 21:25:26 +02:00
si . cbSize = sizeof ( si ) ;
si . fMask = SIF_RANGE ;
si . nMin = min ;
si . nMax = max ;
SetScrollInfo ( hwnd , ctl , & si , TRUE ) ;
if ( ( style & ( WS_DLGFRAME | WS_BORDER | WS_THICKFRAME ) ) | | ( exstyle & WS_EX_DLGMODALFRAME ) )
2004-08-25 19:35:06 +02:00
ok_sequence ( WmSetScrollRangeHV_NC_Seq , " SetScrollInfo(SB_HORZ/SB_VERT) NC " , FALSE ) ;
2004-07-09 21:25:26 +02:00
else
2004-12-20 17:59:26 +01:00
ok_sequence ( WmSetScrollRangeHVSeq , " SetScrollInfo(SB_HORZ/SB_VERT) " , FALSE ) ;
2004-07-09 21:25:26 +02:00
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
2006-10-07 21:45:11 +02:00
if ( set ) ok ( style & set , " style %08x should be set \n " , set ) ;
if ( clear ) ok ( ! ( style & clear ) , " style %08x should not be set \n " , clear ) ;
2004-07-09 21:25:26 +02:00
/* a subsequent call should do nothing */
SetScrollInfo ( hwnd , ctl , & si , TRUE ) ;
2005-01-06 21:43:34 +01:00
if ( style & WS_HSCROLL )
ok_sequence ( WmSetScrollRangeHSeq_empty , " SetScrollInfo(SB_HORZ/SB_VERT) empty sequence " , FALSE ) ;
else if ( style & WS_VSCROLL )
ok_sequence ( WmSetScrollRangeVSeq_empty , " SetScrollInfo(SB_HORZ/SB_VERT) empty sequence " , FALSE ) ;
else
ok_sequence ( WmEmptySeq , " SetScrollInfo(SB_HORZ/SB_VERT) empty sequence " , FALSE ) ;
2004-07-09 21:25:26 +02:00
si . fMask = SIF_PAGE ;
si . nPage = 5 ;
SetScrollInfo ( hwnd , ctl , & si , FALSE ) ;
2005-01-06 21:43:34 +01:00
ok_sequence ( WmEmptySeq , " SetScrollInfo(SB_HORZ/SB_VERT) empty sequence " , FALSE ) ;
2004-07-09 21:25:26 +02:00
si . fMask = SIF_POS ;
si . nPos = max - 1 ;
SetScrollInfo ( hwnd , ctl , & si , FALSE ) ;
2005-01-06 21:43:34 +01:00
ok_sequence ( WmEmptySeq , " SetScrollInfo(SB_HORZ/SB_VERT) empty sequence " , FALSE ) ;
2004-07-09 21:25:26 +02:00
si . fMask = SIF_RANGE ;
si . nMin = 0xdeadbeef ;
si . nMax = 0xdeadbeef ;
2004-12-27 18:26:37 +01:00
ret = GetScrollInfo ( hwnd , ctl , & si ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " GetScrollInfo error %d \n " , GetLastError ( ) ) ;
2005-01-06 21:43:34 +01:00
ok_sequence ( WmEmptySeq , " GetScrollRange(SB_HORZ/SB_VERT) empty sequence " , FALSE ) ;
2004-07-09 21:25:26 +02:00
ok ( si . nMin = = min , " unexpected min scroll value %d \n " , si . nMin ) ;
ok ( si . nMax = = max , " unexpected max scroll value %d \n " , si . nMax ) ;
}
/* Win9x sends WM_USER+xxx while and NT versions send SBM_xxx messages */
static void test_scroll_messages ( HWND hwnd )
{
SCROLLINFO si ;
INT min , max ;
2004-12-27 18:26:37 +01:00
BOOL ret ;
2004-07-09 21:25:26 +02:00
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
flush_sequence ( ) ;
2004-07-09 21:25:26 +02:00
min = 0xdeadbeef ;
max = 0xdeadbeef ;
2004-12-27 18:26:37 +01:00
ret = GetScrollRange ( hwnd , SB_CTL , & min , & max ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " GetScrollRange error %d \n " , GetLastError ( ) ) ;
2004-07-09 21:25:26 +02:00
if ( sequence - > message ! = WmGetScrollRangeSeq [ 0 ] . message )
trace ( " GetScrollRange(SB_CTL) generated unknown message %04x \n " , sequence - > message ) ;
/* values of min and max are undefined */
flush_sequence ( ) ;
2004-12-27 18:26:37 +01:00
ret = SetScrollRange ( hwnd , SB_CTL , 10 , 150 , FALSE ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " SetScrollRange error %d \n " , GetLastError ( ) ) ;
2004-07-09 21:25:26 +02:00
if ( sequence - > message ! = WmSetScrollRangeSeq [ 0 ] . message )
trace ( " SetScrollRange(SB_CTL) generated unknown message %04x \n " , sequence - > message ) ;
flush_sequence ( ) ;
min = 0xdeadbeef ;
max = 0xdeadbeef ;
2004-12-27 18:26:37 +01:00
ret = GetScrollRange ( hwnd , SB_CTL , & min , & max ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " GetScrollRange error %d \n " , GetLastError ( ) ) ;
2004-07-09 21:25:26 +02:00
if ( sequence - > message ! = WmGetScrollRangeSeq [ 0 ] . message )
trace ( " GetScrollRange(SB_CTL) generated unknown message %04x \n " , sequence - > message ) ;
/* values of min and max are undefined */
flush_sequence ( ) ;
si . cbSize = sizeof ( si ) ;
si . fMask = SIF_RANGE ;
si . nMin = 20 ;
si . nMax = 160 ;
SetScrollInfo ( hwnd , SB_CTL , & si , FALSE ) ;
if ( sequence - > message ! = WmSetScrollRangeSeq [ 0 ] . message )
trace ( " SetScrollInfo(SB_CTL) generated unknown message %04x \n " , sequence - > message ) ;
flush_sequence ( ) ;
si . fMask = SIF_PAGE ;
si . nPage = 10 ;
SetScrollInfo ( hwnd , SB_CTL , & si , FALSE ) ;
if ( sequence - > message ! = WmSetScrollRangeSeq [ 0 ] . message )
trace ( " SetScrollInfo(SB_CTL) generated unknown message %04x \n " , sequence - > message ) ;
flush_sequence ( ) ;
si . fMask = SIF_POS ;
si . nPos = 20 ;
SetScrollInfo ( hwnd , SB_CTL , & si , FALSE ) ;
if ( sequence - > message ! = WmSetScrollRangeSeq [ 0 ] . message )
trace ( " SetScrollInfo(SB_CTL) generated unknown message %04x \n " , sequence - > message ) ;
flush_sequence ( ) ;
si . fMask = SIF_RANGE ;
si . nMin = 0xdeadbeef ;
si . nMax = 0xdeadbeef ;
2004-12-27 18:26:37 +01:00
ret = GetScrollInfo ( hwnd , SB_CTL , & si ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " GetScrollInfo error %d \n " , GetLastError ( ) ) ;
2004-07-09 21:25:26 +02:00
if ( sequence - > message ! = WmGetScrollInfoSeq [ 0 ] . message )
trace ( " GetScrollInfo(SB_CTL) generated unknown message %04x \n " , sequence - > message ) ;
/* values of min and max are undefined */
flush_sequence ( ) ;
/* set WS_HSCROLL */
test_hv_scroll_1 ( hwnd , SB_HORZ , 0 , WS_HSCROLL , 10 , 150 ) ;
/* clear WS_HSCROLL */
test_hv_scroll_1 ( hwnd , SB_HORZ , WS_HSCROLL , 0 , 0 , 0 ) ;
/* set WS_HSCROLL */
test_hv_scroll_2 ( hwnd , SB_HORZ , 0 , WS_HSCROLL , 10 , 150 ) ;
/* clear WS_HSCROLL */
test_hv_scroll_2 ( hwnd , SB_HORZ , WS_HSCROLL , 0 , 0 , 0 ) ;
/* set WS_VSCROLL */
test_hv_scroll_1 ( hwnd , SB_VERT , 0 , WS_VSCROLL , 10 , 150 ) ;
/* clear WS_VSCROLL */
test_hv_scroll_1 ( hwnd , SB_VERT , WS_VSCROLL , 0 , 0 , 0 ) ;
/* set WS_VSCROLL */
test_hv_scroll_2 ( hwnd , SB_VERT , 0 , WS_VSCROLL , 10 , 150 ) ;
/* clear WS_VSCROLL */
test_hv_scroll_2 ( hwnd , SB_VERT , WS_VSCROLL , 0 , 0 , 0 ) ;
}
2005-01-25 12:21:20 +01:00
static void test_showwindow ( void )
{
HWND hwnd , hchild ;
2005-11-30 12:32:22 +01:00
RECT rc ;
2005-01-25 12:21:20 +01:00
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test overlapped " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hwnd , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child \n " ) ;
flush_sequence ( ) ;
/* ShowWindow( SW_SHOWNA) for invisible top level window */
trace ( " calling ShowWindow( SW_SHOWNA) for invisible top level window \n " ) ;
ok ( ShowWindow ( hwnd , SW_SHOWNA ) = = FALSE , " ShowWindow: window was visible \n " ) ;
2009-02-25 12:25:03 +01:00
ok_sequence ( WmSHOWNATopInvisible , " ShowWindow(SW_SHOWNA) on invisible top level window " , FALSE ) ;
2005-01-25 12:21:20 +01:00
/* ShowWindow( SW_SHOWNA) for now visible top level window */
trace ( " calling ShowWindow( SW_SHOWNA) for now visible top level window \n " ) ;
ok ( ShowWindow ( hwnd , SW_SHOWNA ) ! = FALSE , " ShowWindow: window was invisible \n " ) ;
2005-02-22 17:02:58 +01:00
ok_sequence ( WmSHOWNATopVisible , " ShowWindow(SW_SHOWNA) on visible top level window " , FALSE ) ;
2005-01-25 12:21:20 +01:00
/* back to invisible */
ShowWindow ( hchild , SW_HIDE ) ;
ShowWindow ( hwnd , SW_HIDE ) ;
flush_sequence ( ) ;
/* ShowWindow(SW_SHOWNA) with child and parent invisible */
trace ( " calling ShowWindow( SW_SHOWNA) for invisible child with invisible parent \n " ) ;
ok ( ShowWindow ( hchild , SW_SHOWNA ) = = FALSE , " ShowWindow: window was visible \n " ) ;
2005-11-09 11:35:48 +01:00
ok_sequence ( WmSHOWNAChildInvisParInvis , " ShowWindow(SW_SHOWNA) invisible child and parent " , FALSE ) ;
2005-01-25 12:21:20 +01:00
/* ShowWindow(SW_SHOWNA) with child visible and parent invisible */
ok ( ShowWindow ( hchild , SW_SHOW ) ! = FALSE , " ShowWindow: window was invisible \n " ) ;
flush_sequence ( ) ;
trace ( " calling ShowWindow( SW_SHOWNA) for the visible child and invisible parent \n " ) ;
ok ( ShowWindow ( hchild , SW_SHOWNA ) ! = FALSE , " ShowWindow: window was invisible \n " ) ;
2005-11-09 11:35:48 +01:00
ok_sequence ( WmSHOWNAChildVisParInvis , " ShowWindow(SW_SHOWNA) visible child and invisible parent " , FALSE ) ;
2005-01-25 12:21:20 +01:00
/* ShowWindow(SW_SHOWNA) with child visible and parent visible */
ShowWindow ( hwnd , SW_SHOW ) ;
flush_sequence ( ) ;
trace ( " calling ShowWindow( SW_SHOWNA) for the visible child and parent \n " ) ;
ok ( ShowWindow ( hchild , SW_SHOWNA ) ! = FALSE , " ShowWindow: window was invisible \n " ) ;
2005-02-22 17:02:58 +01:00
ok_sequence ( WmSHOWNAChildVisParVis , " ShowWindow(SW_SHOWNA) for the visible child and parent " , FALSE ) ;
2005-01-25 12:21:20 +01:00
/* ShowWindow(SW_SHOWNA) with child invisible and parent visible */
ShowWindow ( hchild , SW_HIDE ) ;
flush_sequence ( ) ;
trace ( " calling ShowWindow( SW_SHOWNA) for the invisible child and visible parent \n " ) ;
ok ( ShowWindow ( hchild , SW_SHOWNA ) = = FALSE , " ShowWindow: window was visible \n " ) ;
2005-02-22 17:02:58 +01:00
ok_sequence ( WmSHOWNAChildInvisParVis , " ShowWindow(SW_SHOWNA) for the invisible child and visible parent " , FALSE ) ;
2005-01-25 12:21:20 +01:00
2005-03-14 18:15:33 +01:00
SetCapture ( hchild ) ;
ok ( GetCapture ( ) = = hchild , " wrong capture window %p \n " , GetCapture ( ) ) ;
2005-01-25 12:21:20 +01:00
DestroyWindow ( hchild ) ;
2005-03-14 18:15:33 +01:00
ok ( ! GetCapture ( ) , " wrong capture window %p \n " , GetCapture ( ) ) ;
2005-01-25 12:21:20 +01:00
DestroyWindow ( hwnd ) ;
flush_sequence ( ) ;
2005-11-30 12:32:22 +01:00
/* Popup windows */
/* Test 1:
* 1. Create invisible maximized popup window .
* 2. Move and resize it .
* 3. Show it maximized .
*/
trace ( " calling CreateWindowExA( WS_MAXIMIZE ) for invisible maximized popup window \n " ) ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test popup " , WS_POPUP | WS_MAXIMIZE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create popup window \n " ) ;
2006-05-17 09:35:26 +02:00
ok ( IsZoomed ( hwnd ) , " window should be maximized \n " ) ;
2005-11-30 12:32:22 +01:00
ok_sequence ( WmCreateInvisibleMaxPopupSeq , " CreateWindow(WS_MAXIMIZED):popup " , FALSE ) ;
GetWindowRect ( hwnd , & rc ) ;
ok ( rc . right - rc . left = = GetSystemMetrics ( SM_CXSCREEN ) & &
rc . bottom - rc . top = = GetSystemMetrics ( SM_CYSCREEN ) ,
2006-10-07 21:45:11 +02:00
" Invalid maximized size before ShowWindow (%d,%d)-(%d,%d) \n " ,
2005-11-30 12:32:22 +01:00
rc . left , rc . top , rc . right , rc . bottom ) ;
/* Reset window's size & position */
SetWindowPos ( hwnd , 0 , 10 , 10 , 200 , 200 , SWP_NOZORDER | SWP_NOACTIVATE ) ;
2006-05-17 09:35:26 +02:00
ok ( IsZoomed ( hwnd ) , " window should be maximized \n " ) ;
2005-11-30 12:32:22 +01:00
flush_sequence ( ) ;
2006-05-17 09:35:26 +02:00
trace ( " calling ShowWindow( SW_SHOWMAXIMIZE ) for invisible maximized popup window \n " ) ;
2005-11-30 12:32:22 +01:00
ShowWindow ( hwnd , SW_SHOWMAXIMIZED ) ;
2006-05-17 09:35:26 +02:00
ok ( IsZoomed ( hwnd ) , " window should be maximized \n " ) ;
2006-12-22 11:32:04 +01:00
ok_sequence ( WmShowMaxPopupResizedSeq , " ShowWindow(SW_SHOWMAXIMIZED):invisible maximized and resized popup " , FALSE ) ;
2005-11-30 12:32:22 +01:00
GetWindowRect ( hwnd , & rc ) ;
2005-11-30 12:43:50 +01:00
ok ( rc . right - rc . left = = GetSystemMetrics ( SM_CXSCREEN ) & &
2005-11-30 12:32:22 +01:00
rc . bottom - rc . top = = GetSystemMetrics ( SM_CYSCREEN ) ,
2006-10-07 21:45:11 +02:00
" Invalid maximized size after ShowWindow (%d,%d)-(%d,%d) \n " ,
2005-11-30 12:32:22 +01:00
rc . left , rc . top , rc . right , rc . bottom ) ;
DestroyWindow ( hwnd ) ;
flush_sequence ( ) ;
/* Test 2:
* 1. Create invisible maximized popup window .
* 2. Show it maximized .
*/
trace ( " calling CreateWindowExA( WS_MAXIMIZE ) for invisible maximized popup window \n " ) ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test popup " , WS_POPUP | WS_MAXIMIZE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create popup window \n " ) ;
2006-05-17 09:35:26 +02:00
ok ( IsZoomed ( hwnd ) , " window should be maximized \n " ) ;
2005-11-30 12:32:22 +01:00
ok_sequence ( WmCreateInvisibleMaxPopupSeq , " CreateWindow(WS_MAXIMIZED):popup " , FALSE ) ;
2006-05-17 09:35:26 +02:00
trace ( " calling ShowWindow( SW_SHOWMAXIMIZE ) for invisible maximized popup window \n " ) ;
2005-11-30 12:32:22 +01:00
ShowWindow ( hwnd , SW_SHOWMAXIMIZED ) ;
2006-05-17 09:35:26 +02:00
ok ( IsZoomed ( hwnd ) , " window should be maximized \n " ) ;
2006-12-22 11:32:04 +01:00
ok_sequence ( WmShowMaxPopupSeq , " ShowWindow(SW_SHOWMAXIMIZED):invisible maximized popup " , FALSE ) ;
2005-11-30 12:32:22 +01:00
DestroyWindow ( hwnd ) ;
flush_sequence ( ) ;
/* Test 3:
* 1. Create visible maximized popup window .
*/
trace ( " calling CreateWindowExA( WS_MAXIMIZE ) for maximized popup window \n " ) ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test popup " , WS_POPUP | WS_MAXIMIZE | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create popup window \n " ) ;
2006-05-17 09:35:26 +02:00
ok ( IsZoomed ( hwnd ) , " window should be maximized \n " ) ;
2005-11-30 12:37:47 +01:00
ok_sequence ( WmCreateMaxPopupSeq , " CreateWindow(WS_MAXIMIZED):popup " , FALSE ) ;
2005-11-30 12:32:22 +01:00
DestroyWindow ( hwnd ) ;
flush_sequence ( ) ;
/* Test 4:
* 1. Create visible popup window .
* 2. Maximize it .
*/
trace ( " calling CreateWindowExA( WS_VISIBLE ) for popup window \n " ) ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test popup " , WS_POPUP | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create popup window \n " ) ;
2006-05-17 09:35:26 +02:00
ok ( ! IsZoomed ( hwnd ) , " window should NOT be maximized \n " ) ;
2007-08-20 22:06:50 +02:00
ok_sequence ( WmCreatePopupSeq , " CreateWindow(WS_VISIBLE):popup " , FALSE ) ;
2005-11-30 12:32:22 +01:00
trace ( " calling ShowWindow( SW_SHOWMAXIMIZE ) for visible popup window \n " ) ;
ShowWindow ( hwnd , SW_SHOWMAXIMIZED ) ;
2006-05-17 09:35:26 +02:00
ok ( IsZoomed ( hwnd ) , " window should be maximized \n " ) ;
2006-12-19 12:35:42 +01:00
ok_sequence ( WmShowVisMaxPopupSeq , " ShowWindow(SW_SHOWMAXIMIZED):popup " , FALSE ) ;
2005-11-30 12:32:22 +01:00
DestroyWindow ( hwnd ) ;
flush_sequence ( ) ;
2005-01-25 12:21:20 +01:00
}
2006-11-02 12:18:32 +01:00
static void test_sys_menu ( void )
2005-03-30 20:59:27 +02:00
{
2006-11-02 12:18:32 +01:00
HWND hwnd ;
2005-03-30 20:59:27 +02:00
HMENU hmenu ;
UINT state ;
2006-11-02 12:18:32 +01:00
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , NULL , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
flush_sequence ( ) ;
2005-03-30 20:59:27 +02:00
/* test existing window without CS_NOCLOSE style */
hmenu = GetSystemMenu ( hwnd , FALSE ) ;
2006-10-07 21:45:11 +02:00
ok ( hmenu ! = 0 , " GetSystemMenu error %d \n " , GetLastError ( ) ) ;
2005-03-30 20:59:27 +02:00
state = GetMenuState ( hmenu , SC_CLOSE , MF_BYCOMMAND ) ;
ok ( state ! = 0xffffffff , " wrong SC_CLOSE state %x \n " , state ) ;
ok ( ! ( state & ( MF_DISABLED | MF_GRAYED ) ) , " wrong SC_CLOSE state %x \n " , state ) ;
EnableMenuItem ( hmenu , SC_CLOSE , MF_BYCOMMAND | MF_GRAYED ) ;
ok_sequence ( WmEmptySeq , " WmEnableMenuItem " , FALSE ) ;
state = GetMenuState ( hmenu , SC_CLOSE , MF_BYCOMMAND ) ;
ok ( state ! = 0xffffffff , " wrong SC_CLOSE state %x \n " , state ) ;
ok ( ( state & ( MF_DISABLED | MF_GRAYED ) ) = = MF_GRAYED , " wrong SC_CLOSE state %x \n " , state ) ;
EnableMenuItem ( hmenu , SC_CLOSE , 0 ) ;
ok_sequence ( WmEmptySeq , " WmEnableMenuItem " , FALSE ) ;
state = GetMenuState ( hmenu , SC_CLOSE , MF_BYCOMMAND ) ;
ok ( state ! = 0xffffffff , " wrong SC_CLOSE state %x \n " , state ) ;
ok ( ! ( state & ( MF_DISABLED | MF_GRAYED ) ) , " wrong SC_CLOSE state %x \n " , state ) ;
2006-11-02 12:18:32 +01:00
/* test whether removing WS_SYSMENU destroys a system menu */
SetWindowLongW ( hwnd , GWL_STYLE , WS_POPUP ) ;
SetWindowPos ( hwnd , 0 , 0 , 0 , 0 , 0 , SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED ) ;
flush_sequence ( ) ;
hmenu = GetSystemMenu ( hwnd , FALSE ) ;
ok ( hmenu ! = 0 , " GetSystemMenu error %d \n " , GetLastError ( ) ) ;
DestroyWindow ( hwnd ) ;
2005-03-30 20:59:27 +02:00
/* test new window with CS_NOCLOSE style */
hwnd = CreateWindowExA ( 0 , " NoCloseWindowClass " , NULL , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
hmenu = GetSystemMenu ( hwnd , FALSE ) ;
2006-10-07 21:45:11 +02:00
ok ( hmenu ! = 0 , " GetSystemMenu error %d \n " , GetLastError ( ) ) ;
2005-03-30 20:59:27 +02:00
state = GetMenuState ( hmenu , SC_CLOSE , MF_BYCOMMAND ) ;
ok ( state = = 0xffffffff , " wrong SC_CLOSE state %x \n " , state ) ;
DestroyWindow ( hwnd ) ;
2007-01-08 04:16:36 +01:00
/* test new window without WS_SYSMENU style */
hwnd = CreateWindowExA ( 0 , " NoCloseWindowClass " , NULL , WS_OVERLAPPEDWINDOW & ~ WS_SYSMENU ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
hmenu = GetSystemMenu ( hwnd , FALSE ) ;
ok ( ! hmenu , " GetSystemMenu error %d \n " , GetLastError ( ) ) ;
DestroyWindow ( hwnd ) ;
2005-03-30 20:59:27 +02:00
}
2007-01-19 13:06:59 +01:00
/* For shown WS_OVERLAPPEDWINDOW */
static const struct message WmSetIcon_1 [ ] = {
{ WM_SETICON , sent } ,
{ 0x00AE , sent | defwinproc | optional } , /* XP */
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } , /* XP sends a duplicate */
{ 0 }
} ;
/* For WS_POPUP and hidden WS_OVERLAPPEDWINDOW */
static const struct message WmSetIcon_2 [ ] = {
{ WM_SETICON , sent } ,
{ 0 }
} ;
2007-09-30 18:56:08 +02:00
/* Sending undocumented 0x3B message with wparam = 0x8000000b */
static const struct message WmInitEndSession [ ] = {
{ 0x003B , sent } ,
{ WM_QUERYENDSESSION , sent | defwinproc | wparam | lparam , 0 , ENDSESSION_LOGOFF } ,
{ 0 }
} ;
/* Sending undocumented 0x3B message with wparam = 0x0000000b */
static const struct message WmInitEndSession_2 [ ] = {
{ 0x003B , sent } ,
{ WM_QUERYENDSESSION , sent | defwinproc | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
/* Sending undocumented 0x3B message with wparam = 0x80000008 */
static const struct message WmInitEndSession_3 [ ] = {
{ 0x003B , sent } ,
{ WM_ENDSESSION , sent | defwinproc | wparam | lparam , 0 , ENDSESSION_LOGOFF } ,
{ 0 }
} ;
/* Sending undocumented 0x3B message with wparam = 0x00000008 */
static const struct message WmInitEndSession_4 [ ] = {
{ 0x003B , sent } ,
{ WM_ENDSESSION , sent | defwinproc | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
/* Sending undocumented 0x3B message with wparam = 0x80000001 */
static const struct message WmInitEndSession_5 [ ] = {
{ 0x003B , sent } ,
2008-07-31 17:16:22 +02:00
{ WM_ENDSESSION , sent | defwinproc /*|wparam*/ | lparam , 1 , ENDSESSION_LOGOFF } ,
2007-09-30 18:56:08 +02:00
{ 0 }
} ;
2009-01-16 12:33:07 +01:00
static const struct message WmOptionalPaint [ ] = {
{ WM_PAINT , sent | optional } ,
{ WM_NCPAINT , sent | beginpaint | optional } ,
{ WM_GETTEXT , sent | beginpaint | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
{ 0 }
} ;
2008-07-15 01:50:56 +02:00
static const struct message WmZOrder [ ] = {
{ WM_WINDOWPOSCHANGING , sent | wparam , 0 , 0 } ,
{ WM_GETMINMAXINFO , sent | defwinproc | wparam , 0 , 0 } ,
{ HCBT_ACTIVATE , hook } ,
2008-09-16 16:27:47 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2008-07-15 01:50:56 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , 3 , 0 } ,
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE , 0 } ,
2008-07-31 17:16:22 +02:00
{ WM_GETTEXT , sent | optional } ,
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } ,
2008-07-15 01:50:56 +02:00
{ WM_ACTIVATEAPP , sent | wparam , 1 , 0 } ,
2009-02-26 14:28:38 +01:00
{ WM_NCACTIVATE , sent | lparam , 1 , 0 } ,
2008-07-31 17:16:22 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
2008-07-15 01:50:56 +02:00
{ WM_ACTIVATE , sent | wparam | lparam , 1 , 0 } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2008-07-31 17:16:22 +02:00
{ WM_GETTEXT , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ WM_NCCALCSIZE , sent | optional } ,
2008-07-15 01:50:56 +02:00
{ 0 }
} ;
2007-03-14 16:46:56 +01:00
static void test_MsgWaitForMultipleObjects ( HWND hwnd )
{
DWORD ret ;
MSG msg ;
ret = MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 0 , QS_POSTMESSAGE ) ;
ok ( ret = = WAIT_TIMEOUT , " MsgWaitForMultipleObjects returned %x \n " , ret ) ;
PostMessageA ( hwnd , WM_USER , 0 , 0 ) ;
ret = MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 0 , QS_POSTMESSAGE ) ;
ok ( ret = = WAIT_OBJECT_0 , " MsgWaitForMultipleObjects returned %x \n " , ret ) ;
2008-08-04 23:07:10 +02:00
ok ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) , " PeekMessage should succeed \n " ) ;
2007-03-14 16:46:56 +01:00
ok ( msg . message = = WM_USER , " got %04x instead of WM_USER \n " , msg . message ) ;
ret = MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 0 , QS_POSTMESSAGE ) ;
ok ( ret = = WAIT_TIMEOUT , " MsgWaitForMultipleObjects returned %x \n " , ret ) ;
PostMessageA ( hwnd , WM_USER , 0 , 0 ) ;
ret = MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 0 , QS_POSTMESSAGE ) ;
ok ( ret = = WAIT_OBJECT_0 , " MsgWaitForMultipleObjects returned %x \n " , ret ) ;
2008-08-04 23:07:10 +02:00
ok ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) , " PeekMessage should succeed \n " ) ;
2007-03-14 16:46:56 +01:00
ok ( msg . message = = WM_USER , " got %04x instead of WM_USER \n " , msg . message ) ;
/* shows QS_POSTMESSAGE flag is cleared in the PeekMessage call */
ret = MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 0 , QS_POSTMESSAGE ) ;
ok ( ret = = WAIT_TIMEOUT , " MsgWaitForMultipleObjects returned %x \n " , ret ) ;
PostMessageA ( hwnd , WM_USER , 0 , 0 ) ;
/* new incoming message causes it to become signaled again */
ret = MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 0 , QS_POSTMESSAGE ) ;
ok ( ret = = WAIT_OBJECT_0 , " MsgWaitForMultipleObjects returned %x \n " , ret ) ;
2008-08-04 23:07:10 +02:00
ok ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) , " PeekMessage should succeed \n " ) ;
2007-03-14 16:46:56 +01:00
ok ( msg . message = = WM_USER , " got %04x instead of WM_USER \n " , msg . message ) ;
2008-08-04 23:07:10 +02:00
ok ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) , " PeekMessage should succeed \n " ) ;
2007-03-14 16:46:56 +01:00
ok ( msg . message = = WM_USER , " got %04x instead of WM_USER \n " , msg . message ) ;
}
2003-10-02 06:32:56 +02:00
/* test if we receive the right sequence of messages */
static void test_messages ( void )
{
HWND hwnd , hparent , hchild ;
HWND hchild2 , hbutton ;
2004-02-17 21:29:05 +01:00
HMENU hmenu ;
2004-11-23 18:39:13 +01:00
MSG msg ;
2007-09-30 18:56:08 +02:00
LRESULT res ;
2003-10-02 06:32:56 +02:00
2005-01-11 11:38:31 +01:00
flush_sequence ( ) ;
2003-10-02 06:32:56 +02:00
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test overlapped " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmCreateOverlappedSeq , " CreateWindow:overlapped " , FALSE ) ;
2004-04-08 21:07:06 +02:00
2004-06-04 01:26:35 +02:00
/* test ShowWindow(SW_HIDE) on a newly created invisible window */
ok ( ShowWindow ( hwnd , SW_HIDE ) = = FALSE , " ShowWindow: window was visible \n " ) ;
2005-02-18 21:01:41 +01:00
ok_sequence ( WmEmptySeq , " ShowWindow(SW_HIDE):overlapped, invisible " , FALSE ) ;
2004-06-04 01:26:35 +02:00
2004-04-08 21:07:06 +02:00
/* test WM_SETREDRAW on a not visible top level window */
test_WM_SETREDRAW ( hwnd ) ;
2004-05-10 21:59:20 +02:00
SetWindowPos ( hwnd , 0 , 0 , 0 , 0 , 0 , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmSWP_ShowOverlappedSeq , " SetWindowPos:SWP_SHOWWINDOW:overlapped " , FALSE ) ;
2004-05-10 21:59:20 +02:00
ok ( IsWindowVisible ( hwnd ) , " window should be visible at this point \n " ) ;
ok ( GetActiveWindow ( ) = = hwnd , " window should be active \n " ) ;
ok ( GetFocus ( ) = = hwnd , " window should have input focus \n " ) ;
ShowWindow ( hwnd , SW_HIDE ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2008-06-19 14:15:58 +02:00
ok_sequence ( WmHideOverlappedSeq , " ShowWindow(SW_HIDE):overlapped " , FALSE ) ;
2005-09-28 20:11:10 +02:00
2004-04-02 22:22:53 +02:00
ShowWindow ( hwnd , SW_SHOW ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmShowOverlappedSeq , " ShowWindow(SW_SHOW):overlapped " , TRUE ) ;
2004-05-10 21:59:20 +02:00
2005-09-12 12:09:40 +02:00
ShowWindow ( hwnd , SW_HIDE ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2005-11-14 12:24:06 +01:00
ok_sequence ( WmHideOverlappedSeq , " ShowWindow(SW_HIDE):overlapped " , FALSE ) ;
2005-09-12 12:09:40 +02:00
ShowWindow ( hwnd , SW_SHOWMAXIMIZED ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2005-09-12 12:09:40 +02:00
ok_sequence ( WmShowMaxOverlappedSeq , " ShowWindow(SW_SHOWMAXIMIZED):overlapped " , TRUE ) ;
flush_sequence ( ) ;
2009-02-13 13:02:08 +01:00
if ( GetWindowLongW ( hwnd , GWL_STYLE ) & WS_MAXIMIZE )
{
ShowWindow ( hwnd , SW_RESTORE ) ;
flush_events ( ) ;
2009-02-16 11:52:17 +01:00
ok_sequence ( WmShowRestoreMaxOverlappedSeq , " ShowWindow(SW_RESTORE):overlapped " , TRUE ) ;
2009-02-13 13:02:08 +01:00
flush_sequence ( ) ;
}
2007-04-12 02:45:42 +02:00
ShowWindow ( hwnd , SW_MINIMIZE ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2007-04-12 02:45:42 +02:00
ok_sequence ( WmShowMinOverlappedSeq , " ShowWindow(SW_SHOWMINIMIZED):overlapped " , TRUE ) ;
flush_sequence ( ) ;
2009-02-13 13:02:08 +01:00
if ( GetWindowLongW ( hwnd , GWL_STYLE ) & WS_MINIMIZE )
{
ShowWindow ( hwnd , SW_RESTORE ) ;
flush_events ( ) ;
ok_sequence ( WmShowRestoreMinOverlappedSeq , " ShowWindow(SW_RESTORE):overlapped " , TRUE ) ;
flush_sequence ( ) ;
}
2007-04-12 02:45:42 +02:00
2005-01-25 12:31:52 +01:00
ShowWindow ( hwnd , SW_SHOW ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2009-01-16 12:33:07 +01:00
ok_sequence ( WmOptionalPaint , " ShowWindow(SW_SHOW):overlapped already visible " , FALSE ) ;
2005-01-25 12:31:52 +01:00
2004-05-10 21:59:20 +02:00
SetWindowPos ( hwnd , 0 , 0 , 0 , 0 , 0 , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE ) ;
2004-12-20 17:59:26 +01:00
ok_sequence ( WmSWP_HideOverlappedSeq , " SetWindowPos:SWP_HIDEWINDOW:overlapped " , FALSE ) ;
2004-05-10 21:59:20 +02:00
ok ( ! IsWindowVisible ( hwnd ) , " window should not be visible at this point \n " ) ;
2005-06-17 23:05:16 +02:00
ok ( GetActiveWindow ( ) = = hwnd , " window should still be active \n " ) ;
2003-10-02 06:32:56 +02:00
2004-04-08 21:07:06 +02:00
/* test WM_SETREDRAW on a visible top level window */
2004-05-10 21:59:20 +02:00
ShowWindow ( hwnd , SW_SHOW ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2004-04-08 21:07:06 +02:00
test_WM_SETREDRAW ( hwnd ) ;
2004-07-09 21:25:26 +02:00
trace ( " testing scroll APIs on a visible top level window %p \n " , hwnd ) ;
test_scroll_messages ( hwnd ) ;
2005-01-25 12:31:52 +01:00
/* test resizing and moving */
2007-01-07 12:40:46 +01:00
SetWindowPos ( hwnd , 0 , 0 , 0 , 300 , 300 , SWP_NOMOVE | SWP_NOACTIVATE ) ;
2005-01-25 12:31:52 +01:00
ok_sequence ( WmSWP_ResizeSeq , " SetWindowPos:Resize " , FALSE ) ;
2007-04-26 16:29:10 +02:00
flush_events ( ) ;
flush_sequence ( ) ;
2007-01-07 12:40:46 +01:00
SetWindowPos ( hwnd , 0 , 200 , 200 , 0 , 0 , SWP_NOSIZE | SWP_NOACTIVATE ) ;
2005-01-25 12:31:52 +01:00
ok_sequence ( WmSWP_MoveSeq , " SetWindowPos:Move " , FALSE ) ;
2007-04-26 16:29:10 +02:00
flush_events ( ) ;
flush_sequence ( ) ;
2008-07-31 17:16:22 +02:00
SetWindowPos ( hwnd , 0 , 200 , 200 , 250 , 250 , SWP_NOZORDER | SWP_NOACTIVATE ) ;
2007-04-26 16:29:10 +02:00
ok_sequence ( WmSWP_ResizeNoZOrder , " SetWindowPos:WmSWP_ResizeNoZOrder " , FALSE ) ;
flush_events ( ) ;
flush_sequence ( ) ;
2005-01-25 12:31:52 +01:00
/* popups don't get WM_GETMINMAXINFO */
SetWindowLongW ( hwnd , GWL_STYLE , WS_VISIBLE | WS_POPUP ) ;
SetWindowPos ( hwnd , 0 , 0 , 0 , 0 , 0 , SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED ) ;
flush_sequence ( ) ;
2007-01-07 12:40:46 +01:00
SetWindowPos ( hwnd , 0 , 0 , 0 , 200 , 200 , SWP_NOMOVE | SWP_NOACTIVATE ) ;
2005-01-25 12:31:52 +01:00
ok_sequence ( WmSWP_ResizePopupSeq , " SetWindowPos:ResizePopup " , FALSE ) ;
2003-10-02 06:32:56 +02:00
DestroyWindow ( hwnd ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmDestroyOverlappedSeq , " DestroyWindow:overlapped " , FALSE ) ;
2003-10-02 06:32:56 +02:00
2004-03-26 00:35:52 +01:00
hparent = CreateWindowExA ( 0 , " TestParentClass " , " Test parent " , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
2003-10-02 06:32:56 +02:00
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hparent ! = 0 , " Failed to create parent window \n " ) ;
flush_sequence ( ) ;
2004-04-29 22:00:40 +02:00
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD | WS_MAXIMIZE ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child window \n " ) ;
2006-12-19 12:35:42 +01:00
ok_sequence ( WmCreateMaximizedChildSeq , " CreateWindow:maximized child " , FALSE ) ;
2004-04-29 22:00:40 +02:00
DestroyWindow ( hchild ) ;
flush_sequence ( ) ;
2004-09-21 02:24:22 +02:00
/* visible child window with a caption */
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " ,
WS_CHILD | WS_VISIBLE | WS_CAPTION ,
2004-06-18 21:33:55 +02:00
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child window \n " ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmCreateVisibleChildSeq , " CreateWindow:visible child " , FALSE ) ;
2004-07-09 21:25:26 +02:00
trace ( " testing scroll APIs on a visible child window %p \n " , hchild ) ;
test_scroll_messages ( hchild ) ;
2004-09-21 02:24:22 +02:00
SetWindowPos ( hchild , 0 , 0 , 0 , 0 , 0 , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE ) ;
ok_sequence ( WmShowChildSeq_4 , " SetWindowPos(SWP_SHOWWINDOW):child with a caption " , FALSE ) ;
2004-06-18 21:33:55 +02:00
DestroyWindow ( hchild ) ;
flush_sequence ( ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
2003-10-02 06:32:56 +02:00
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child window \n " ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmCreateChildSeq , " CreateWindow:child " , FALSE ) ;
2003-10-02 06:32:56 +02:00
2004-06-18 21:33:55 +02:00
hchild2 = CreateWindowExA ( 0 , " SimpleWindowClass " , " Test child2 " , WS_CHILD ,
2003-10-02 06:32:56 +02:00
100 , 100 , 50 , 50 , hparent , 0 , 0 , NULL ) ;
ok ( hchild2 ! = 0 , " Failed to create child2 window \n " ) ;
flush_sequence ( ) ;
2004-06-18 21:33:55 +02:00
hbutton = CreateWindowExA ( 0 , " TestWindowClass " , " Test button " , WS_CHILD ,
2003-10-02 06:32:56 +02:00
0 , 100 , 50 , 50 , hchild , 0 , 0 , NULL ) ;
ok ( hbutton ! = 0 , " Failed to create button window \n " ) ;
2004-04-08 21:07:06 +02:00
/* test WM_SETREDRAW on a not visible child window */
test_WM_SETREDRAW ( hchild ) ;
2003-10-02 06:32:56 +02:00
2004-04-02 22:22:53 +02:00
ShowWindow ( hchild , SW_SHOW ) ;
2004-09-13 20:03:09 +02:00
ok_sequence ( WmShowChildSeq , " ShowWindow(SW_SHOW):child " , FALSE ) ;
2007-07-27 03:27:53 +02:00
/* check parent messages too */
log_all_parent_messages + + ;
ShowWindow ( hchild , SW_HIDE ) ;
2007-07-31 20:32:15 +02:00
ok_sequence ( WmHideChildSeq2 , " ShowWindow(SW_HIDE):child " , FALSE ) ;
2007-07-27 03:27:53 +02:00
log_all_parent_messages - - ;
ShowWindow ( hchild , SW_SHOW ) ;
ok_sequence ( WmShowChildSeq , " ShowWindow(SW_SHOW):child " , FALSE ) ;
2004-09-13 20:03:09 +02:00
ShowWindow ( hchild , SW_HIDE ) ;
ok_sequence ( WmHideChildSeq , " ShowWindow(SW_HIDE):child " , FALSE ) ;
ShowWindow ( hchild , SW_SHOW ) ;
ok_sequence ( WmShowChildSeq , " ShowWindow(SW_SHOW):child " , FALSE ) ;
2003-10-02 06:32:56 +02:00
2004-04-08 21:07:06 +02:00
/* test WM_SETREDRAW on a visible child window */
test_WM_SETREDRAW ( hchild ) ;
2007-08-27 15:13:51 +02:00
log_all_parent_messages + + ;
2003-10-02 06:32:56 +02:00
MoveWindow ( hchild , 10 , 10 , 20 , 20 , TRUE ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmResizingChildWithMoveWindowSeq , " MoveWindow:child " , FALSE ) ;
2007-08-27 15:13:51 +02:00
log_all_parent_messages - - ;
2003-10-02 06:32:56 +02:00
2004-06-18 21:33:55 +02:00
ShowWindow ( hchild , SW_HIDE ) ;
flush_sequence ( ) ;
SetWindowPos ( hchild , 0 , 0 , 0 , 0 , 0 , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmShowChildSeq_2 , " SetWindowPos:show_child_2 " , FALSE ) ;
2004-06-18 21:33:55 +02:00
ShowWindow ( hchild , SW_HIDE ) ;
flush_sequence ( ) ;
SetWindowPos ( hchild , 0 , 0 , 0 , 0 , 0 , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmShowChildSeq_3 , " SetWindowPos:show_child_3 " , FALSE ) ;
2004-06-18 21:33:55 +02:00
/* DestroyWindow sequence below expects that a child has focus */
SetFocus ( hchild ) ;
flush_sequence ( ) ;
2003-10-02 06:32:56 +02:00
DestroyWindow ( hchild ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmDestroyChildSeq , " DestroyWindow:child " , FALSE ) ;
2004-02-17 21:29:05 +01:00
DestroyWindow ( hchild2 ) ;
DestroyWindow ( hbutton ) ;
2004-04-02 22:22:53 +02:00
flush_sequence ( ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test Child Popup " , WS_CHILD | WS_POPUP ,
0 , 0 , 100 , 100 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child popup window \n " ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmCreateChildPopupSeq , " CreateWindow:child_popup " , FALSE ) ;
2004-04-02 22:22:53 +02:00
DestroyWindow ( hchild ) ;
/* test what happens to a window which sets WS_VISIBLE in WM_CREATE */
flush_sequence ( ) ;
hchild = CreateWindowExA ( 0 , " TestPopupClass " , " Test Popup " , WS_POPUP ,
0 , 0 , 100 , 100 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create popup window \n " ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmCreateInvisiblePopupSeq , " CreateWindow:invisible_popup " , FALSE ) ;
2004-04-02 22:22:53 +02:00
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( IsWindowVisible ( hchild ) , " IsWindowVisible() should return TRUE \n " ) ;
flush_sequence ( ) ;
ShowWindow ( hchild , SW_SHOW ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmEmptySeq , " ShowWindow:show_visible_popup " , FALSE ) ;
2004-04-02 22:22:53 +02:00
flush_sequence ( ) ;
SetWindowPos ( hchild , 0 , 0 , 0 , 0 , 0 , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmShowVisiblePopupSeq_2 , " SetWindowPos:show_visible_popup_2 " , FALSE ) ;
2004-04-02 22:22:53 +02:00
flush_sequence ( ) ;
SetWindowPos ( hchild , 0 , 0 , 0 , 0 , 0 , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE ) ;
2008-09-16 16:27:47 +02:00
ok_sequence ( WmShowVisiblePopupSeq_3 , " SetWindowPos:show_visible_popup_3 " , FALSE ) ;
2004-04-02 22:22:53 +02:00
DestroyWindow ( hchild ) ;
/* this time add WS_VISIBLE for CreateWindowEx, but this fact actually
* changes nothing in message sequences .
*/
flush_sequence ( ) ;
hchild = CreateWindowExA ( 0 , " TestPopupClass " , " Test Popup " , WS_POPUP | WS_VISIBLE ,
0 , 0 , 100 , 100 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create popup window \n " ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmCreateInvisiblePopupSeq , " CreateWindow:invisible_popup " , FALSE ) ;
2004-04-02 22:22:53 +02:00
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( IsWindowVisible ( hchild ) , " IsWindowVisible() should return TRUE \n " ) ;
flush_sequence ( ) ;
ShowWindow ( hchild , SW_SHOW ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmEmptySeq , " ShowWindow:show_visible_popup " , FALSE ) ;
2004-04-02 22:22:53 +02:00
flush_sequence ( ) ;
SetWindowPos ( hchild , 0 , 0 , 0 , 0 , 0 , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmShowVisiblePopupSeq_2 , " SetWindowPos:show_visible_popup_2 " , FALSE ) ;
2004-04-02 22:22:53 +02:00
DestroyWindow ( hchild ) ;
2004-04-20 06:02:50 +02:00
flush_sequence ( ) ;
hwnd = CreateWindowExA ( WS_EX_DLGMODALFRAME , " TestDialogClass " , NULL , WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_DLGFRAME ,
0 , 0 , 100 , 100 , hparent , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create custom dialog window \n " ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmCreateCustomDialogSeq , " CreateCustomDialog " , TRUE ) ;
2004-05-18 22:44:23 +02:00
2010-06-29 21:56:45 +02:00
if ( 0 ) {
2004-07-09 21:25:26 +02:00
trace ( " testing scroll APIs on a visible dialog %p \n " , hwnd ) ;
test_scroll_messages ( hwnd ) ;
2010-06-29 21:56:45 +02:00
}
2004-07-09 21:25:26 +02:00
2007-02-14 11:45:45 +01:00
flush_sequence ( ) ;
test_def_id = 1 ;
SendMessage ( hwnd , WM_NULL , 0 , 0 ) ;
2004-05-18 22:44:23 +02:00
flush_sequence ( ) ;
after_end_dialog = 1 ;
EndDialog ( hwnd , 0 ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmEndCustomDialogSeq , " EndCustomDialog " , FALSE ) ;
2004-05-18 22:44:23 +02:00
2004-04-20 06:02:50 +02:00
DestroyWindow ( hwnd ) ;
2004-05-18 22:44:23 +02:00
after_end_dialog = 0 ;
2007-02-14 11:45:45 +01:00
test_def_id = 0 ;
2004-05-18 22:44:23 +02:00
2005-01-06 21:43:34 +01:00
hwnd = CreateWindowExA ( 0 , " TestDialogClass " , NULL , WS_POPUP ,
0 , 0 , 100 , 100 , 0 , 0 , GetModuleHandleA ( 0 ) , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create custom dialog window \n " ) ;
flush_sequence ( ) ;
trace ( " call ShowWindow(%p, SW_SHOW) \n " , hwnd ) ;
ShowWindow ( hwnd , SW_SHOW ) ;
ok_sequence ( WmShowCustomDialogSeq , " ShowCustomDialog " , TRUE ) ;
DestroyWindow ( hwnd ) ;
2004-05-18 22:44:23 +02:00
flush_sequence ( ) ;
DialogBoxA ( 0 , " TEST_DIALOG " , hparent , TestModalDlgProcA ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmModalDialogSeq , " ModalDialog " , TRUE ) ;
2004-04-20 06:02:50 +02:00
2004-02-17 21:29:05 +01:00
DestroyWindow ( hparent ) ;
flush_sequence ( ) ;
/* Message sequence for SetMenu */
2004-10-09 01:36:18 +02:00
ok ( ! DrawMenuBar ( hwnd ) , " DrawMenuBar should return FALSE for a window without a menu \n " ) ;
ok_sequence ( WmEmptySeq , " DrawMenuBar for a window without a menu " , FALSE ) ;
2004-02-17 21:29:05 +01:00
hmenu = CreateMenu ( ) ;
ok ( hmenu ! = 0 , " Failed to create menu \n " ) ;
ok ( InsertMenuA ( hmenu , - 1 , MF_BYPOSITION , 0x1000 , " foo " ) , " InsertMenu failed \n " ) ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test overlapped " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , hmenu , 0 , NULL ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmCreateOverlappedSeq , " CreateWindow:overlapped " , FALSE ) ;
2004-05-05 03:35:37 +02:00
ok ( SetMenu ( hwnd , 0 ) , " SetMenu \n " ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmSetMenuNonVisibleSizeChangeSeq , " SetMenu:NonVisibleSizeChange " , FALSE ) ;
2004-05-05 03:35:37 +02:00
ok ( SetMenu ( hwnd , 0 ) , " SetMenu \n " ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( WmSetMenuNonVisibleNoSizeChangeSeq , " SetMenu:NonVisibleNoSizeChange " , FALSE ) ;
2004-04-02 22:22:53 +02:00
ShowWindow ( hwnd , SW_SHOW ) ;
2005-09-28 17:13:10 +02:00
UpdateWindow ( hwnd ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-02-17 21:29:05 +01:00
flush_sequence ( ) ;
2004-05-05 03:35:37 +02:00
ok ( SetMenu ( hwnd , 0 ) , " SetMenu \n " ) ;
2005-09-28 17:13:10 +02:00
ok_sequence ( WmSetMenuVisibleNoSizeChangeSeq , " SetMenu:VisibleNoSizeChange " , FALSE ) ;
2004-05-05 03:35:37 +02:00
ok ( SetMenu ( hwnd , hmenu ) , " SetMenu \n " ) ;
2005-09-28 17:13:10 +02:00
ok_sequence ( WmSetMenuVisibleSizeChangeSeq , " SetMenu:VisibleSizeChange " , FALSE ) ;
2004-02-17 21:29:05 +01:00
2005-09-28 17:13:10 +02:00
UpdateWindow ( hwnd ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
flush_sequence ( ) ;
2004-05-24 21:08:54 +02:00
ok ( DrawMenuBar ( hwnd ) , " DrawMenuBar \n " ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
ok_sequence ( WmDrawMenuBarSeq , " DrawMenuBar " , FALSE ) ;
2004-05-24 21:08:54 +02:00
2004-04-20 06:02:50 +02:00
DestroyWindow ( hwnd ) ;
2004-06-03 02:08:55 +02:00
flush_sequence ( ) ;
/* Message sequence for EnableWindow */
hparent = CreateWindowExA ( 0 , " TestWindowClass " , " Test parent " , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hparent ! = 0 , " Failed to create parent window \n " ) ;
2004-06-18 21:33:55 +02:00
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD | WS_VISIBLE ,
2004-06-03 02:08:55 +02:00
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child window \n " ) ;
SetFocus ( hchild ) ;
2006-10-28 10:42:56 +02:00
flush_events ( ) ;
2004-06-03 02:08:55 +02:00
flush_sequence ( ) ;
EnableWindow ( hparent , FALSE ) ;
2005-06-07 22:29:09 +02:00
ok_sequence ( WmEnableWindowSeq_1 , " EnableWindow(FALSE) " , FALSE ) ;
EnableWindow ( hparent , TRUE ) ;
ok_sequence ( WmEnableWindowSeq_2 , " EnableWindow(TRUE) " , FALSE ) ;
2004-06-03 02:08:55 +02:00
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-11-23 18:39:13 +01:00
flush_sequence ( ) ;
2005-01-06 21:43:34 +01:00
2007-03-14 16:46:56 +01:00
test_MsgWaitForMultipleObjects ( hparent ) ;
2005-07-07 19:20:44 +02:00
2005-01-06 21:43:34 +01:00
/* the following test causes an exception in user.exe under win9x */
2007-01-07 12:40:46 +01:00
if ( ! PostMessageW ( hparent , WM_USER , 0 , 0 ) )
{
DestroyWindow ( hparent ) ;
flush_sequence ( ) ;
return ;
}
2005-01-06 21:43:34 +01:00
PostMessageW ( hparent , WM_USER + 1 , 0 , 0 ) ;
2004-11-23 18:39:13 +01:00
/* PeekMessage(NULL) fails, but still removes the message */
SetLastError ( 0xdeadbeef ) ;
2005-01-06 21:43:34 +01:00
ok ( ! PeekMessageW ( NULL , 0 , 0 , 0 , PM_REMOVE ) , " PeekMessage(NULL) should fail \n " ) ;
2005-03-14 11:05:50 +01:00
ok ( GetLastError ( ) = = ERROR_NOACCESS | | /* Win2k */
GetLastError ( ) = = 0xdeadbeef , /* NT4 */
2006-10-07 21:45:11 +02:00
" last error is %d \n " , GetLastError ( ) ) ;
2005-01-06 21:43:34 +01:00
ok ( PeekMessageW ( & msg , 0 , 0 , 0 , PM_REMOVE ) , " PeekMessage should succeed \n " ) ;
2004-11-23 18:39:13 +01:00
ok ( msg . message = = WM_USER + 1 , " got %x instead of WM_USER+1 \n " , msg . message ) ;
2004-10-06 01:45:35 +02:00
DestroyWindow ( hchild ) ;
2004-06-03 02:08:55 +02:00
DestroyWindow ( hparent ) ;
flush_sequence ( ) ;
2007-01-19 13:06:59 +01:00
/* Message sequences for WM_SETICON */
trace ( " testing WM_SETICON \n " ) ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , NULL , WS_OVERLAPPEDWINDOW ,
CW_USEDEFAULT , CW_USEDEFAULT , 300 , 300 , 0 ,
NULL , NULL , 0 ) ;
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2007-01-19 13:06:59 +01:00
flush_sequence ( ) ;
SendMessage ( hwnd , WM_SETICON , ICON_SMALL , ( LPARAM ) LoadIcon ( 0 , IDI_APPLICATION ) ) ;
ok_sequence ( WmSetIcon_1 , " WM_SETICON for shown window with caption " , FALSE ) ;
ShowWindow ( hwnd , SW_HIDE ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2007-01-19 13:06:59 +01:00
flush_sequence ( ) ;
SendMessage ( hwnd , WM_SETICON , ICON_SMALL , ( LPARAM ) LoadIcon ( 0 , IDI_APPLICATION ) ) ;
ok_sequence ( WmSetIcon_2 , " WM_SETICON for hidden window with caption " , FALSE ) ;
DestroyWindow ( hwnd ) ;
flush_sequence ( ) ;
hwnd = CreateWindowExA ( 0 , " TestPopupClass " , NULL , WS_POPUP ,
CW_USEDEFAULT , CW_USEDEFAULT , 300 , 300 , 0 ,
NULL , NULL , 0 ) ;
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2007-01-19 13:06:59 +01:00
flush_sequence ( ) ;
SendMessage ( hwnd , WM_SETICON , ICON_SMALL , ( LPARAM ) LoadIcon ( 0 , IDI_APPLICATION ) ) ;
ok_sequence ( WmSetIcon_2 , " WM_SETICON for shown window without caption " , FALSE ) ;
ShowWindow ( hwnd , SW_HIDE ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2007-01-19 13:06:59 +01:00
flush_sequence ( ) ;
SendMessage ( hwnd , WM_SETICON , ICON_SMALL , ( LPARAM ) LoadIcon ( 0 , IDI_APPLICATION ) ) ;
ok_sequence ( WmSetIcon_2 , " WM_SETICON for hidden window without caption " , FALSE ) ;
2007-09-30 18:56:08 +02:00
flush_sequence ( ) ;
res = SendMessage ( hwnd , 0x3B , 0x8000000b , 0 ) ;
2008-08-04 23:07:10 +02:00
if ( ! res )
{
todo_wine win_skip ( " Message 0x3b not supported \n " ) ;
goto done ;
}
2007-09-30 18:56:08 +02:00
ok_sequence ( WmInitEndSession , " Handling of undocumented 0x3B message by DefWindowProc wparam=0x8000000b " , TRUE ) ;
ok ( res = = 1 , " SendMessage(hwnd, 0x3B, 0x8000000b, 0) should have returned 1 instead of %ld \n " , res ) ;
res = SendMessage ( hwnd , 0x3B , 0x0000000b , 0 ) ;
ok_sequence ( WmInitEndSession_2 , " Handling of undocumented 0x3B message by DefWindowProc wparam=0x0000000b " , TRUE ) ;
ok ( res = = 1 , " SendMessage(hwnd, 0x3B, 0x0000000b, 0) should have returned 1 instead of %ld \n " , res ) ;
res = SendMessage ( hwnd , 0x3B , 0x0000000f , 0 ) ;
ok_sequence ( WmInitEndSession_2 , " Handling of undocumented 0x3B message by DefWindowProc wparam=0x0000000f " , TRUE ) ;
ok ( res = = 1 , " SendMessage(hwnd, 0x3B, 0x0000000f, 0) should have returned 1 instead of %ld \n " , res ) ;
flush_sequence ( ) ;
res = SendMessage ( hwnd , 0x3B , 0x80000008 , 0 ) ;
ok_sequence ( WmInitEndSession_3 , " Handling of undocumented 0x3B message by DefWindowProc wparam=0x80000008 " , TRUE ) ;
ok ( res = = 2 , " SendMessage(hwnd, 0x3B, 0x80000008, 0) should have returned 2 instead of %ld \n " , res ) ;
res = SendMessage ( hwnd , 0x3B , 0x00000008 , 0 ) ;
ok_sequence ( WmInitEndSession_4 , " Handling of undocumented 0x3B message by DefWindowProc wparam=0x00000008 " , TRUE ) ;
ok ( res = = 2 , " SendMessage(hwnd, 0x3B, 0x00000008, 0) should have returned 2 instead of %ld \n " , res ) ;
res = SendMessage ( hwnd , 0x3B , 0x80000004 , 0 ) ;
ok_sequence ( WmInitEndSession_3 , " Handling of undocumented 0x3B message by DefWindowProc wparam=0x80000004 " , TRUE ) ;
ok ( res = = 2 , " SendMessage(hwnd, 0x3B, 0x80000004, 0) should have returned 2 instead of %ld \n " , res ) ;
res = SendMessage ( hwnd , 0x3B , 0x80000001 , 0 ) ;
ok_sequence ( WmInitEndSession_5 , " Handling of undocumented 0x3B message by DefWindowProc wparam=0x80000001 " , TRUE ) ;
ok ( res = = 2 , " SendMessage(hwnd, 0x3B, 0x80000001, 0) should have returned 2 instead of %ld \n " , res ) ;
2008-08-04 23:07:10 +02:00
done :
2007-01-19 13:06:59 +01:00
DestroyWindow ( hwnd ) ;
flush_sequence ( ) ;
2003-10-02 06:32:56 +02:00
}
2008-07-15 01:50:56 +02:00
static void test_setwindowpos ( void )
{
HWND hwnd ;
RECT rc ;
LRESULT res ;
const INT winX = 100 ;
const INT winY = 100 ;
const INT sysX = GetSystemMetrics ( SM_CXMINTRACK ) ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , NULL , 0 ,
0 , 0 , winX , winY , 0 ,
NULL , NULL , 0 ) ;
GetWindowRect ( hwnd , & rc ) ;
2008-07-15 01:51:15 +02:00
expect ( sysX , rc . right ) ;
2008-07-15 01:50:56 +02:00
expect ( winY , rc . bottom ) ;
flush_events ( ) ;
flush_sequence ( ) ;
res = SetWindowPos ( hwnd , HWND_TOPMOST , 0 , 0 , winX , winY , 0 ) ;
ok_sequence ( WmZOrder , " Z-Order " , TRUE ) ;
ok ( res = = TRUE , " SetWindowPos expected TRUE, got %ld \n " , res ) ;
GetWindowRect ( hwnd , & rc ) ;
expect ( sysX , rc . right ) ;
expect ( winY , rc . bottom ) ;
DestroyWindow ( hwnd ) ;
}
2006-05-16 12:33:19 +02:00
static void invisible_parent_tests ( void )
{
HWND hparent , hchild ;
hparent = CreateWindowExA ( 0 , " TestParentClass " , " Test parent " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hparent ! = 0 , " Failed to create parent window \n " ) ;
flush_sequence ( ) ;
/* test showing child with hidden parent */
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child window \n " ) ;
ok_sequence ( WmCreateChildSeq , " CreateWindow:child " , FALSE ) ;
ShowWindow ( hchild , SW_MINIMIZE ) ;
2006-05-17 09:35:26 +02:00
ok_sequence ( WmShowChildInvisibleParentSeq_1 , " ShowWindow(SW_MINIMIZE) child with invisible parent " , FALSE ) ;
2006-05-16 12:33:19 +02:00
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
/* repeat */
flush_events ( ) ;
2007-01-07 12:40:46 +01:00
flush_sequence ( ) ;
2006-05-16 12:33:19 +02:00
ShowWindow ( hchild , SW_MINIMIZE ) ;
2006-05-17 09:35:26 +02:00
ok_sequence ( WmShowChildInvisibleParentSeq_1r , " ShowWindow(SW_MINIMIZE) child with invisible parent " , FALSE ) ;
2006-05-16 12:33:19 +02:00
DestroyWindow ( hchild ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
flush_sequence ( ) ;
ShowWindow ( hchild , SW_MAXIMIZE ) ;
2006-05-17 09:35:26 +02:00
ok_sequence ( WmShowChildInvisibleParentSeq_2 , " ShowWindow(SW_MAXIMIZE) child with invisible parent " , FALSE ) ;
2006-05-16 12:33:19 +02:00
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
/* repeat */
flush_events ( ) ;
2007-01-07 12:40:46 +01:00
flush_sequence ( ) ;
2006-05-16 12:33:19 +02:00
ShowWindow ( hchild , SW_MAXIMIZE ) ;
2006-05-17 09:35:26 +02:00
ok_sequence ( WmShowChildInvisibleParentSeq_2r , " ShowWindow(SW_MAXIMIZE) child with invisible parent " , FALSE ) ;
2006-05-16 12:33:19 +02:00
DestroyWindow ( hchild ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
flush_sequence ( ) ;
2006-12-19 12:35:42 +01:00
ShowWindow ( hchild , SW_RESTORE ) ;
ok_sequence ( WmShowChildInvisibleParentSeq_5 , " ShowWindow(SW_RESTORE) child with invisible parent " , FALSE ) ;
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
DestroyWindow ( hchild ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
flush_sequence ( ) ;
2006-05-16 12:33:19 +02:00
ShowWindow ( hchild , SW_SHOWMINIMIZED ) ;
2006-05-17 09:35:26 +02:00
ok_sequence ( WmShowChildInvisibleParentSeq_3 , " ShowWindow(SW_SHOWMINIMIZED) child with invisible parent " , FALSE ) ;
2006-05-16 12:33:19 +02:00
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
/* repeat */
flush_events ( ) ;
2007-01-07 12:40:46 +01:00
flush_sequence ( ) ;
2006-05-16 12:33:19 +02:00
ShowWindow ( hchild , SW_SHOWMINIMIZED ) ;
2006-05-17 09:35:26 +02:00
ok_sequence ( WmShowChildInvisibleParentSeq_3r , " ShowWindow(SW_SHOWMINIMIZED) child with invisible parent " , FALSE ) ;
2006-05-16 12:33:19 +02:00
DestroyWindow ( hchild ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
flush_sequence ( ) ;
/* same as ShowWindow( hchild, SW_MAXIMIZE ); */
ShowWindow ( hchild , SW_SHOWMAXIMIZED ) ;
2006-05-17 09:35:26 +02:00
ok_sequence ( WmShowChildInvisibleParentSeq_2 , " ShowWindow(SW_SHOWMAXIMIZED) child with invisible parent " , FALSE ) ;
2006-05-16 12:33:19 +02:00
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
DestroyWindow ( hchild ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
flush_sequence ( ) ;
ShowWindow ( hchild , SW_SHOWMINNOACTIVE ) ;
2006-05-17 09:35:26 +02:00
ok_sequence ( WmShowChildInvisibleParentSeq_4 , " ShowWindow(SW_SHOWMINNOACTIVE) child with invisible parent " , FALSE ) ;
2006-05-16 12:33:19 +02:00
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
/* repeat */
flush_events ( ) ;
2007-01-07 12:40:46 +01:00
flush_sequence ( ) ;
2006-05-16 12:33:19 +02:00
ShowWindow ( hchild , SW_SHOWMINNOACTIVE ) ;
2006-05-17 09:35:26 +02:00
ok_sequence ( WmShowChildInvisibleParentSeq_4r , " ShowWindow(SW_SHOWMINNOACTIVE) child with invisible parent " , FALSE ) ;
2006-05-16 12:33:19 +02:00
DestroyWindow ( hchild ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
flush_sequence ( ) ;
/* FIXME: looks like XP SP2 doesn't know about SW_FORCEMINIMIZE at all */
ShowWindow ( hchild , SW_FORCEMINIMIZE ) ;
ok_sequence ( WmEmptySeq , " ShowWindow(SW_FORCEMINIMIZE) child with invisible parent " , TRUE ) ;
todo_wine {
ok ( ! ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE ) , " WS_VISIBLE should be not set \n " ) ;
}
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
DestroyWindow ( hchild ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
flush_sequence ( ) ;
ShowWindow ( hchild , SW_SHOWNA ) ;
ok_sequence ( WmShowChildInvisibleParentSeq_5 , " ShowWindow(SW_SHOWNA) child with invisible parent " , FALSE ) ;
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
/* repeat */
flush_events ( ) ;
2007-01-07 12:40:46 +01:00
flush_sequence ( ) ;
2006-05-16 12:33:19 +02:00
ShowWindow ( hchild , SW_SHOWNA ) ;
ok_sequence ( WmShowChildInvisibleParentSeq_5 , " ShowWindow(SW_SHOWNA) child with invisible parent " , FALSE ) ;
DestroyWindow ( hchild ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD ,
0 , 0 , 10 , 10 , hparent , 0 , 0 , NULL ) ;
flush_sequence ( ) ;
ShowWindow ( hchild , SW_SHOW ) ;
ok_sequence ( WmShowChildInvisibleParentSeq_5 , " ShowWindow(SW_SHOW) child with invisible parent " , FALSE ) ;
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
/* repeat */
flush_events ( ) ;
2007-01-07 12:40:46 +01:00
flush_sequence ( ) ;
2006-05-16 12:33:19 +02:00
ShowWindow ( hchild , SW_SHOW ) ;
ok_sequence ( WmEmptySeq , " ShowWindow(SW_SHOW) child with invisible parent " , FALSE ) ;
ShowWindow ( hchild , SW_HIDE ) ;
ok_sequence ( WmHideChildInvisibleParentSeq , " ShowWindow:hide child with invisible parent " , FALSE ) ;
ok ( ! ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE ) , " WS_VISIBLE should be not set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
SetWindowPos ( hchild , 0 , 0 , 0 , 0 , 0 , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER ) ;
ok_sequence ( WmShowChildInvisibleParentSeq_6 , " SetWindowPos:show child with invisible parent " , FALSE ) ;
ok ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE , " WS_VISIBLE should be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
SetWindowPos ( hchild , 0 , 0 , 0 , 0 , 0 , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER ) ;
ok_sequence ( WmHideChildInvisibleParentSeq_2 , " SetWindowPos:hide child with invisible parent " , FALSE ) ;
ok ( ! ( GetWindowLongA ( hchild , GWL_STYLE ) & WS_VISIBLE ) , " WS_VISIBLE should not be set \n " ) ;
ok ( ! IsWindowVisible ( hchild ) , " IsWindowVisible() should return FALSE \n " ) ;
SetWindowPos ( hchild , 0 , 0 , 0 , 0 , 0 , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER ) ;
flush_sequence ( ) ;
DestroyWindow ( hchild ) ;
ok_sequence ( WmDestroyInvisibleChildSeq , " DestroyInvisibleChildSeq " , FALSE ) ;
DestroyWindow ( hparent ) ;
flush_sequence ( ) ;
}
2004-08-10 01:38:40 +02:00
/****************** button message test *************************/
2009-06-18 13:06:33 +02:00
# define ID_BUTTON 0x000e
2004-08-10 01:38:40 +02:00
static const struct message WmSetFocusButtonSeq [ ] =
{
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2006-11-20 15:20:54 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-08-10 01:38:40 +02:00
{ WM_SETFOCUS , sent | wparam , 0 } ,
2009-06-18 13:06:33 +02:00
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_BUTTON , BN_SETFOCUS ) } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
2004-08-10 01:38:40 +02:00
{ 0 }
} ;
static const struct message WmKillFocusButtonSeq [ ] =
{
{ HCBT_SETFOCUS , hook } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-08-10 01:38:40 +02:00
{ WM_KILLFOCUS , sent | wparam , 0 } ,
2009-06-18 13:06:33 +02:00
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_BUTTON , BN_KILLFOCUS ) } ,
2004-08-10 01:38:40 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
2006-11-20 15:20:54 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 1 } ,
2009-06-18 13:06:33 +02:00
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ WM_PAINT , sent } ,
{ WM_CTLCOLORBTN , sent | parent } ,
2004-08-10 01:38:40 +02:00
{ 0 }
} ;
static const struct message WmSetFocusStaticSeq [ ] =
{
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2006-11-20 15:20:54 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-08-10 01:38:40 +02:00
{ WM_SETFOCUS , sent | wparam , 0 } ,
2009-06-18 13:06:33 +02:00
{ WM_CTLCOLORSTATIC , sent | parent } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_BUTTON , BN_SETFOCUS ) } ,
{ WM_COMMAND , sent | wparam | parent | optional , MAKEWPARAM ( ID_BUTTON , BN_CLICKED ) } , /* radio button */
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
2004-08-10 01:38:40 +02:00
{ 0 }
} ;
static const struct message WmKillFocusStaticSeq [ ] =
{
{ HCBT_SETFOCUS , hook } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-08-10 01:38:40 +02:00
{ WM_KILLFOCUS , sent | wparam , 0 } ,
2009-06-18 13:06:33 +02:00
{ WM_CTLCOLORSTATIC , sent | parent } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_BUTTON , BN_KILLFOCUS ) } ,
2004-08-10 01:38:40 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
2006-11-20 15:20:54 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 1 } ,
2009-06-18 13:06:33 +02:00
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ WM_PAINT , sent } ,
{ WM_CTLCOLORSTATIC , sent | parent } ,
{ 0 }
} ;
static const struct message WmSetFocusOwnerdrawSeq [ ] =
{
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent | wparam , 0 } ,
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_BUTTON , 0x001040e4 } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_BUTTON , BN_SETFOCUS ) } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmKillFocusOwnerdrawSeq [ ] =
{
{ HCBT_SETFOCUS , hook } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_KILLFOCUS , sent | wparam , 0 } ,
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_BUTTON , 0x000040e4 } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_BUTTON , BN_KILLFOCUS ) } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 1 } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ WM_PAINT , sent } ,
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_BUTTON , 0x000010e4 } ,
2004-08-10 01:38:40 +02:00
{ 0 }
} ;
2004-08-26 20:31:56 +02:00
static const struct message WmLButtonDownSeq [ ] =
{
{ WM_LBUTTONDOWN , sent | wparam | lparam , 0 , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-08-26 20:31:56 +02:00
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2006-11-20 15:20:54 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-08-26 20:31:56 +02:00
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
{ WM_CTLCOLORBTN , sent | defwinproc } ,
{ BM_SETSTATE , sent | wparam | defwinproc , TRUE } ,
{ WM_CTLCOLORBTN , sent | defwinproc } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_STATECHANGE , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2004-08-26 20:31:56 +02:00
{ 0 }
} ;
static const struct message WmLButtonUpSeq [ ] =
{
{ WM_LBUTTONUP , sent | wparam | lparam , 0 , 0 } ,
{ BM_SETSTATE , sent | wparam | defwinproc , FALSE } ,
{ WM_CTLCOLORBTN , sent | defwinproc } ,
2005-01-06 21:43:34 +01:00
{ EVENT_OBJECT_STATECHANGE , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ EVENT_SYSTEM_CAPTUREEND , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-08-26 20:31:56 +02:00
{ WM_CAPTURECHANGED , sent | wparam | defwinproc , 0 } ,
{ 0 }
} ;
2007-02-06 19:10:15 +01:00
static const struct message WmSetFontButtonSeq [ ] =
{
{ WM_SETFONT , sent } ,
{ WM_PAINT , sent } ,
2007-03-03 05:48:46 +01:00
{ WM_ERASEBKGND , sent | defwinproc | optional } ,
2007-02-06 19:10:15 +01:00
{ WM_CTLCOLORBTN , sent | defwinproc } ,
{ 0 }
} ;
2009-07-02 12:27:18 +02:00
static const struct message WmSetStyleButtonSeq [ ] =
{
{ BM_SETSTYLE , sent } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | defwinproc | optional } , /* FIXME: Wine sends it */
2009-07-06 08:16:01 +02:00
{ WM_ERASEBKGND , sent | defwinproc | optional } , /* Win9x doesn't send it */
2009-07-02 12:27:18 +02:00
{ WM_CTLCOLORBTN , sent | parent } ,
{ 0 }
} ;
static const struct message WmSetStyleStaticSeq [ ] =
{
{ BM_SETSTYLE , sent } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | defwinproc | optional } , /* FIXME: Wine sends it */
2009-07-06 08:16:01 +02:00
{ WM_ERASEBKGND , sent | defwinproc | optional } , /* Win9x doesn't send it */
2009-07-02 12:27:18 +02:00
{ WM_CTLCOLORSTATIC , sent | parent } ,
{ 0 }
} ;
static const struct message WmSetStyleUserSeq [ ] =
{
{ BM_SETSTYLE , sent } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | defwinproc | optional } , /* FIXME: Wine sends it */
2009-07-06 08:16:01 +02:00
{ WM_ERASEBKGND , sent | defwinproc | optional } , /* Win9x doesn't send it */
2009-07-02 12:27:18 +02:00
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_BUTTON , BN_PAINT ) } ,
{ 0 }
} ;
static const struct message WmSetStyleOwnerdrawSeq [ ] =
{
{ BM_SETSTYLE , sent } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | optional } , /* FIXME: Wine sends it */
2009-07-06 08:16:01 +02:00
{ WM_ERASEBKGND , sent | defwinproc | optional } , /* Win9x doesn't send it */
2009-07-02 12:27:18 +02:00
{ WM_CTLCOLORBTN , sent | parent } ,
2009-07-06 08:16:01 +02:00
{ WM_CTLCOLORBTN , sent | parent | optional } , /* Win9x doesn't send it */
2009-07-02 12:27:18 +02:00
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_BUTTON , 0x000010e4 } ,
{ 0 }
} ;
2010-04-21 13:29:55 +02:00
static const struct message WmSetStateButtonSeq [ ] =
{
{ BM_SETSTATE , sent } ,
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmSetStateStaticSeq [ ] =
{
{ BM_SETSTATE , sent } ,
{ WM_CTLCOLORSTATIC , sent | parent } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmSetStateUserSeq [ ] =
{
{ BM_SETSTATE , sent } ,
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_BUTTON , BN_HILITE ) } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmSetStateOwnerdrawSeq [ ] =
{
{ BM_SETSTATE , sent } ,
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_BUTTON , 0x000120e4 } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmClearStateButtonSeq [ ] =
{
{ BM_SETSTATE , sent } ,
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_BUTTON , BN_UNHILITE ) } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmClearStateOwnerdrawSeq [ ] =
{
{ BM_SETSTATE , sent } ,
{ WM_CTLCOLORBTN , sent | parent } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_BUTTON , 0x000020e4 } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmSetCheckIgnoredSeq [ ] =
{
{ BM_SETCHECK , sent } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmSetCheckStaticSeq [ ] =
{
{ BM_SETCHECK , sent } ,
{ WM_CTLCOLORSTATIC , sent | parent } ,
{ WM_APP , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
2004-08-10 01:38:40 +02:00
static WNDPROC old_button_proc ;
static LRESULT CALLBACK button_hook_proc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-10-02 12:18:42 +02:00
static LONG defwndproc_counter = 0 ;
2004-08-10 01:38:40 +02:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-08-10 01:38:40 +02:00
2009-05-12 12:09:30 +02:00
if ( ignore_message ( message ) ) return 0 ;
2009-01-16 12:33:07 +01:00
switch ( message )
{
case WM_SYNCPAINT :
break ;
case BM_SETSTATE :
2010-04-21 13:29:55 +02:00
if ( GetCapture ( ) )
ok ( GetCapture ( ) = = hwnd , " GetCapture() = %p \n " , GetCapture ( ) ) ;
2009-01-16 12:33:07 +01:00
/* fall through */
default :
msg . hwnd = hwnd ;
msg . message = message ;
msg . flags = sent | wparam | lparam ;
if ( defwndproc_counter ) msg . flags | = defwinproc ;
msg . wParam = wParam ;
msg . lParam = lParam ;
msg . descr = " button " ;
add_message ( & msg ) ;
}
2004-08-26 20:31:56 +02:00
2004-08-10 01:38:40 +02:00
defwndproc_counter + + ;
ret = CallWindowProcA ( old_button_proc , hwnd , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
}
static void subclass_button ( void )
{
WNDCLASSA cls ;
if ( ! GetClassInfoA ( 0 , " button " , & cls ) ) assert ( 0 ) ;
old_button_proc = cls . lpfnWndProc ;
cls . hInstance = GetModuleHandle ( 0 ) ;
cls . lpfnWndProc = button_hook_proc ;
cls . lpszClassName = " my_button_class " ;
2007-02-20 10:06:21 +01:00
UnregisterClass ( cls . lpszClassName , cls . hInstance ) ;
2004-08-10 01:38:40 +02:00
if ( ! RegisterClassA ( & cls ) ) assert ( 0 ) ;
}
static void test_button_messages ( void )
{
static const struct
{
DWORD style ;
2004-10-26 23:18:10 +02:00
DWORD dlg_code ;
2004-08-10 01:38:40 +02:00
const struct message * setfocus ;
const struct message * killfocus ;
2009-07-02 12:27:18 +02:00
const struct message * setstyle ;
2010-04-21 13:29:55 +02:00
const struct message * setstate ;
const struct message * clearstate ;
const struct message * setcheck ;
2004-08-10 01:38:40 +02:00
} button [ ] = {
2004-10-26 23:18:10 +02:00
{ BS_PUSHBUTTON , DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusButtonSeq , WmKillFocusButtonSeq , WmSetStyleButtonSeq ,
WmSetStateButtonSeq , WmSetStateButtonSeq , WmSetCheckIgnoredSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_DEFPUSHBUTTON , DLGC_BUTTON | DLGC_DEFPUSHBUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusButtonSeq , WmKillFocusButtonSeq , WmSetStyleButtonSeq ,
WmSetStateButtonSeq , WmSetStateButtonSeq , WmSetCheckIgnoredSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_CHECKBOX , DLGC_BUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusStaticSeq , WmKillFocusStaticSeq , WmSetStyleStaticSeq ,
WmSetStateStaticSeq , WmSetStateStaticSeq , WmSetCheckStaticSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_AUTOCHECKBOX , DLGC_BUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusStaticSeq , WmKillFocusStaticSeq , WmSetStyleStaticSeq ,
WmSetStateStaticSeq , WmSetStateStaticSeq , WmSetCheckStaticSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_RADIOBUTTON , DLGC_BUTTON | DLGC_RADIOBUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusStaticSeq , WmKillFocusStaticSeq , WmSetStyleStaticSeq ,
WmSetStateStaticSeq , WmSetStateStaticSeq , WmSetCheckStaticSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_3STATE , DLGC_BUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusStaticSeq , WmKillFocusStaticSeq , WmSetStyleStaticSeq ,
WmSetStateStaticSeq , WmSetStateStaticSeq , WmSetCheckStaticSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_AUTO3STATE , DLGC_BUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusStaticSeq , WmKillFocusStaticSeq , WmSetStyleStaticSeq ,
WmSetStateStaticSeq , WmSetStateStaticSeq , WmSetCheckStaticSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_GROUPBOX , DLGC_STATIC ,
2010-04-21 13:29:55 +02:00
WmSetFocusStaticSeq , WmKillFocusStaticSeq , WmSetStyleStaticSeq ,
WmSetStateStaticSeq , WmSetStateStaticSeq , WmSetCheckIgnoredSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_USERBUTTON , DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusButtonSeq , WmKillFocusButtonSeq , WmSetStyleUserSeq ,
WmSetStateUserSeq , WmClearStateButtonSeq , WmSetCheckIgnoredSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_AUTORADIOBUTTON , DLGC_BUTTON | DLGC_RADIOBUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusStaticSeq , WmKillFocusStaticSeq , WmSetStyleStaticSeq ,
WmSetStateStaticSeq , WmSetStateStaticSeq , WmSetCheckStaticSeq } ,
2004-10-26 23:18:10 +02:00
{ BS_OWNERDRAW , DLGC_BUTTON ,
2010-04-21 13:29:55 +02:00
WmSetFocusOwnerdrawSeq , WmKillFocusOwnerdrawSeq , WmSetStyleOwnerdrawSeq ,
WmSetStateOwnerdrawSeq , WmClearStateOwnerdrawSeq , WmSetCheckIgnoredSeq } ,
2004-08-10 01:38:40 +02:00
} ;
2004-09-22 04:46:38 +02:00
unsigned int i ;
2009-06-18 13:06:33 +02:00
HWND hwnd , parent ;
2004-10-26 23:18:10 +02:00
DWORD dlg_code ;
2007-02-06 19:10:15 +01:00
HFONT zfont ;
2004-08-10 01:38:40 +02:00
2009-03-10 12:09:35 +01:00
/* selection with VK_SPACE should capture button window */
hwnd = CreateWindowExA ( 0 , " button " , " test " , BS_CHECKBOX | WS_VISIBLE | WS_POPUP ,
0 , 0 , 50 , 14 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create button window \n " ) ;
ReleaseCapture ( ) ;
SetFocus ( hwnd ) ;
SendMessageA ( hwnd , WM_KEYDOWN , VK_SPACE , 0 ) ;
ok ( GetCapture ( ) = = hwnd , " Should be captured on VK_SPACE WM_KEYDOWN \n " ) ;
SendMessageA ( hwnd , WM_KEYUP , VK_SPACE , 0 ) ;
DestroyWindow ( hwnd ) ;
2004-08-10 01:38:40 +02:00
subclass_button ( ) ;
2009-06-18 13:06:33 +02:00
parent = CreateWindowExA ( 0 , " TestParentClass " , " Test parent " , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( parent ! = 0 , " Failed to create parent window \n " ) ;
2004-08-10 01:38:40 +02:00
for ( i = 0 ; i < sizeof ( button ) / sizeof ( button [ 0 ] ) ; i + + )
{
2009-06-18 13:06:33 +02:00
MSG msg ;
2010-04-21 13:29:55 +02:00
DWORD style , state ;
2009-06-18 13:06:33 +02:00
2009-07-02 12:27:18 +02:00
trace ( " button style %08x \n " , button [ i ] . style ) ;
2009-06-18 13:06:33 +02:00
hwnd = CreateWindowExA ( 0 , " my_button_class " , " test " , button [ i ] . style | WS_CHILD | BS_NOTIFY ,
0 , 0 , 50 , 14 , parent , ( HMENU ) ID_BUTTON , 0 , NULL ) ;
2004-08-10 01:38:40 +02:00
ok ( hwnd ! = 0 , " Failed to create button window \n " ) ;
2009-06-18 13:06:33 +02:00
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
style & = ~ ( WS_CHILD | BS_NOTIFY ) ;
/* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
if ( button [ i ] . style = = BS_USERBUTTON )
2009-07-02 12:27:18 +02:00
ok ( style = = BS_PUSHBUTTON , " expected style BS_PUSHBUTTON got %x \n " , style ) ;
2009-06-18 13:06:33 +02:00
else
2009-07-02 12:27:18 +02:00
ok ( style = = button [ i ] . style , " expected style %x got %x \n " , button [ i ] . style , style ) ;
2009-06-18 13:06:33 +02:00
2004-10-26 23:18:10 +02:00
dlg_code = SendMessageA ( hwnd , WM_GETDLGCODE , 0 , 0 ) ;
2006-11-20 15:20:54 +01:00
ok ( dlg_code = = button [ i ] . dlg_code , " %u: wrong dlg_code %08x \n " , i , dlg_code ) ;
2004-10-26 23:18:10 +02:00
2004-08-10 01:38:40 +02:00
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
SetFocus ( 0 ) ;
2009-06-18 13:06:33 +02:00
flush_events ( ) ;
2009-12-16 12:28:41 +01:00
SetFocus ( 0 ) ;
2004-08-10 01:38:40 +02:00
flush_sequence ( ) ;
2009-06-18 13:06:33 +02:00
log_all_parent_messages + + ;
ok ( GetFocus ( ) = = 0 , " expected focus 0, got %p \n " , GetFocus ( ) ) ;
2004-08-10 01:38:40 +02:00
SetFocus ( hwnd ) ;
2009-06-18 13:06:33 +02:00
SendMessage ( hwnd , WM_APP , 0 , 0 ) ; /* place a separator mark here */
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( button [ i ] . setfocus , " SetFocus(hwnd) on a button " , FALSE ) ;
2004-08-10 01:38:40 +02:00
SetFocus ( 0 ) ;
2009-06-18 13:06:33 +02:00
SendMessage ( hwnd , WM_APP , 0 , 0 ) ; /* place a separator mark here */
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
2004-08-25 19:35:06 +02:00
ok_sequence ( button [ i ] . killfocus , " SetFocus(0) on a button " , FALSE ) ;
2004-08-10 01:38:40 +02:00
2009-07-02 12:27:18 +02:00
ok ( GetFocus ( ) = = 0 , " expected focus 0, got %p \n " , GetFocus ( ) ) ;
SendMessage ( hwnd , BM_SETSTYLE , button [ i ] . style | BS_BOTTOM , TRUE ) ;
SendMessage ( hwnd , WM_APP , 0 , 0 ) ; /* place a separator mark here */
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( button [ i ] . setstyle , " BM_SETSTYLE on a button " , FALSE ) ;
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
style & = ~ ( WS_VISIBLE | WS_CHILD | BS_NOTIFY ) ;
/* XP doesn't turn a BS_USERBUTTON into BS_PUSHBUTTON here! */
2010-04-21 13:29:55 +02:00
ok ( style = = button [ i ] . style , " expected style %04x got %04x \n " , button [ i ] . style , style ) ;
state = SendMessage ( hwnd , BM_GETSTATE , 0 , 0 ) ;
ok ( state = = 0 , " expected state 0, got %04x \n " , state ) ;
flush_sequence ( ) ;
SendMessage ( hwnd , BM_SETSTATE , TRUE , 0 ) ;
SendMessage ( hwnd , WM_APP , 0 , 0 ) ; /* place a separator mark here */
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( button [ i ] . setstate , " BM_SETSTATE/TRUE on a button " , FALSE ) ;
state = SendMessage ( hwnd , BM_GETSTATE , 0 , 0 ) ;
ok ( state = = 0x0004 , " expected state 0x0004, got %04x \n " , state ) ;
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
style & = ~ ( WS_CHILD | BS_NOTIFY | WS_VISIBLE ) ;
ok ( style = = button [ i ] . style , " expected style %04x got %04x \n " , button [ i ] . style , style ) ;
flush_sequence ( ) ;
SendMessage ( hwnd , BM_SETSTATE , FALSE , 0 ) ;
SendMessage ( hwnd , WM_APP , 0 , 0 ) ; /* place a separator mark here */
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( button [ i ] . clearstate , " BM_SETSTATE/FALSE on a button " , FALSE ) ;
state = SendMessage ( hwnd , BM_GETSTATE , 0 , 0 ) ;
ok ( state = = 0 , " expected state 0, got %04x \n " , state ) ;
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
style & = ~ ( WS_CHILD | BS_NOTIFY | WS_VISIBLE ) ;
ok ( style = = button [ i ] . style , " expected style %04x got %04x \n " , button [ i ] . style , style ) ;
state = SendMessage ( hwnd , BM_GETCHECK , 0 , 0 ) ;
ok ( state = = BST_UNCHECKED , " expected BST_UNCHECKED, got %04x \n " , state ) ;
flush_sequence ( ) ;
SendMessage ( hwnd , BM_SETCHECK , BST_UNCHECKED , 0 ) ;
SendMessage ( hwnd , WM_APP , 0 , 0 ) ; /* place a separator mark here */
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( WmSetCheckIgnoredSeq , " BM_SETCHECK on a button " , FALSE ) ;
state = SendMessage ( hwnd , BM_GETCHECK , 0 , 0 ) ;
ok ( state = = BST_UNCHECKED , " expected BST_UNCHECKED, got %04x \n " , state ) ;
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
style & = ~ ( WS_CHILD | BS_NOTIFY | WS_VISIBLE ) ;
ok ( style = = button [ i ] . style , " expected style %04x got %04x \n " , button [ i ] . style , style ) ;
flush_sequence ( ) ;
SendMessage ( hwnd , BM_SETCHECK , BST_CHECKED , 0 ) ;
SendMessage ( hwnd , WM_APP , 0 , 0 ) ; /* place a separator mark here */
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( button [ i ] . setcheck , " BM_SETCHECK on a button " , FALSE ) ;
state = SendMessage ( hwnd , BM_GETCHECK , 0 , 0 ) ;
if ( button [ i ] . style = = BS_PUSHBUTTON | |
button [ i ] . style = = BS_DEFPUSHBUTTON | |
button [ i ] . style = = BS_GROUPBOX | |
button [ i ] . style = = BS_USERBUTTON | |
button [ i ] . style = = BS_OWNERDRAW )
ok ( state = = BST_UNCHECKED , " expected check 0, got %04x \n " , state ) ;
else
ok ( state = = BST_CHECKED , " expected check 1, got %04x \n " , state ) ;
style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
style & = ~ ( WS_CHILD | BS_NOTIFY | WS_VISIBLE ) ;
if ( button [ i ] . style = = BS_RADIOBUTTON | |
button [ i ] . style = = BS_AUTORADIOBUTTON )
ok ( style = = ( button [ i ] . style | WS_TABSTOP ) , " expected style %04x | WS_TABSTOP got %04x \n " , button [ i ] . style , style ) ;
else
ok ( style = = button [ i ] . style , " expected style %04x got %04x \n " , button [ i ] . style , style ) ;
2009-07-02 12:27:18 +02:00
2009-06-18 13:06:33 +02:00
log_all_parent_messages - - ;
2004-08-10 01:38:40 +02:00
DestroyWindow ( hwnd ) ;
}
2004-08-26 20:31:56 +02:00
2009-06-18 13:06:33 +02:00
DestroyWindow ( parent ) ;
2004-10-26 23:18:10 +02:00
hwnd = CreateWindowExA ( 0 , " my_button_class " , " test " , BS_PUSHBUTTON | WS_POPUP | WS_VISIBLE ,
2004-08-26 20:31:56 +02:00
0 , 0 , 50 , 14 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create button window \n " ) ;
2009-01-19 12:36:11 +01:00
SetForegroundWindow ( hwnd ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2009-02-11 14:21:51 +01:00
SetActiveWindow ( hwnd ) ;
SetFocus ( 0 ) ;
2004-08-26 20:31:56 +02:00
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_LBUTTONDOWN , 0 , 0 ) ;
ok_sequence ( WmLButtonDownSeq , " WM_LBUTTONDOWN on a button " , FALSE ) ;
SendMessageA ( hwnd , WM_LBUTTONUP , 0 , 0 ) ;
2005-01-06 21:43:34 +01:00
ok_sequence ( WmLButtonUpSeq , " WM_LBUTTONUP on a button " , FALSE ) ;
2007-02-06 19:10:15 +01:00
flush_sequence ( ) ;
2008-10-25 23:39:12 +02:00
zfont = GetStockObject ( SYSTEM_FONT ) ;
2007-02-06 19:10:15 +01:00
SendMessageA ( hwnd , WM_SETFONT , ( WPARAM ) zfont , TRUE ) ;
UpdateWindow ( hwnd ) ;
ok_sequence ( WmSetFontButtonSeq , " WM_SETFONT on a button " , FALSE ) ;
2004-08-26 20:31:56 +02:00
DestroyWindow ( hwnd ) ;
2004-08-10 01:38:40 +02:00
}
2004-08-26 02:49:06 +02:00
2006-11-21 12:45:07 +01:00
/****************** static message test *************************/
static const struct message WmSetFontStaticSeq [ ] =
{
{ WM_SETFONT , sent } ,
2009-01-16 12:33:07 +01:00
{ WM_PAINT , sent | defwinproc | optional } ,
2007-03-03 05:48:46 +01:00
{ WM_ERASEBKGND , sent | defwinproc | optional } ,
2009-01-16 12:33:07 +01:00
{ WM_CTLCOLORSTATIC , sent | defwinproc | optional } ,
2006-11-21 12:45:07 +01:00
{ 0 }
} ;
static WNDPROC old_static_proc ;
static LRESULT CALLBACK static_hook_proc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-10-02 12:18:42 +02:00
static LONG defwndproc_counter = 0 ;
2006-11-21 12:45:07 +01:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2006-11-21 12:45:07 +01:00
2009-05-12 12:09:30 +02:00
if ( ignore_message ( message ) ) return 0 ;
2006-11-21 12:45:07 +01:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2006-11-21 12:45:07 +01:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
if ( defwndproc_counter ) msg . flags | = defwinproc ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " static " ;
2006-11-21 12:45:07 +01:00
add_message ( & msg ) ;
defwndproc_counter + + ;
ret = CallWindowProcA ( old_static_proc , hwnd , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
}
static void subclass_static ( void )
{
WNDCLASSA cls ;
if ( ! GetClassInfoA ( 0 , " static " , & cls ) ) assert ( 0 ) ;
old_static_proc = cls . lpfnWndProc ;
cls . hInstance = GetModuleHandle ( 0 ) ;
cls . lpfnWndProc = static_hook_proc ;
cls . lpszClassName = " my_static_class " ;
2007-02-20 10:06:21 +01:00
UnregisterClass ( cls . lpszClassName , cls . hInstance ) ;
2006-11-21 12:45:07 +01:00
if ( ! RegisterClassA ( & cls ) ) assert ( 0 ) ;
}
static void test_static_messages ( void )
{
/* FIXME: make as comprehensive as the button message test */
static const struct
{
DWORD style ;
DWORD dlg_code ;
const struct message * setfont ;
} static_ctrl [ ] = {
{ SS_LEFT , DLGC_STATIC ,
WmSetFontStaticSeq }
} ;
unsigned int i ;
HWND hwnd ;
DWORD dlg_code ;
subclass_static ( ) ;
for ( i = 0 ; i < sizeof ( static_ctrl ) / sizeof ( static_ctrl [ 0 ] ) ; i + + )
{
hwnd = CreateWindowExA ( 0 , " my_static_class " , " test " , static_ctrl [ i ] . style | WS_POPUP ,
0 , 0 , 50 , 14 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create static window \n " ) ;
dlg_code = SendMessageA ( hwnd , WM_GETDLGCODE , 0 , 0 ) ;
ok ( dlg_code = = static_ctrl [ i ] . dlg_code , " %u: wrong dlg_code %08x \n " , i , dlg_code ) ;
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
SetFocus ( 0 ) ;
flush_sequence ( ) ;
trace ( " static style %08x \n " , static_ctrl [ i ] . style ) ;
SendMessage ( hwnd , WM_SETFONT , ( WPARAM ) GetStockObject ( DEFAULT_GUI_FONT ) , TRUE ) ;
ok_sequence ( static_ctrl [ i ] . setfont , " WM_SETFONT on a static " , FALSE ) ;
DestroyWindow ( hwnd ) ;
}
}
2008-03-27 07:35:59 +01:00
/****************** ComboBox message test *************************/
# define ID_COMBOBOX 0x000f
static const struct message WmKeyDownComboSeq [ ] =
{
{ WM_KEYDOWN , sent | wparam | lparam , VK_DOWN , 0 } ,
2008-03-27 15:40:57 +01:00
{ WM_COMMAND , sent | wparam | defwinproc , MAKEWPARAM ( 1000 , LBN_SELCHANGE ) } ,
2008-03-27 07:35:59 +01:00
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_COMBOBOX , CBN_SELENDOK ) } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_COMBOBOX , CBN_SELCHANGE ) } ,
{ WM_CTLCOLOREDIT , sent | parent } ,
{ WM_KEYUP , sent | wparam | lparam , VK_DOWN , 0 } ,
{ 0 }
} ;
static WNDPROC old_combobox_proc ;
static LRESULT CALLBACK combobox_hook_proc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-10-02 12:18:42 +02:00
static LONG defwndproc_counter = 0 ;
2008-03-27 07:35:59 +01:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2008-03-27 07:35:59 +01:00
/* do not log painting messages */
if ( message ! = WM_PAINT & &
message ! = WM_NCPAINT & &
message ! = WM_SYNCPAINT & &
message ! = WM_ERASEBKGND & &
message ! = WM_NCHITTEST & &
message ! = WM_GETTEXT & &
2009-05-12 12:09:30 +02:00
! ignore_message ( message ) )
2008-03-27 07:35:59 +01:00
{
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2008-03-27 07:35:59 +01:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
2008-03-27 15:40:57 +01:00
if ( defwndproc_counter ) msg . flags | = defwinproc ;
2008-03-27 07:35:59 +01:00
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " combo " ;
2008-03-27 07:35:59 +01:00
add_message ( & msg ) ;
}
defwndproc_counter + + ;
ret = CallWindowProcA ( old_combobox_proc , hwnd , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
}
static void subclass_combobox ( void )
{
WNDCLASSA cls ;
if ( ! GetClassInfoA ( 0 , " ComboBox " , & cls ) ) assert ( 0 ) ;
old_combobox_proc = cls . lpfnWndProc ;
cls . hInstance = GetModuleHandle ( 0 ) ;
cls . lpfnWndProc = combobox_hook_proc ;
cls . lpszClassName = " my_combobox_class " ;
UnregisterClass ( cls . lpszClassName , cls . hInstance ) ;
if ( ! RegisterClassA ( & cls ) ) assert ( 0 ) ;
}
static void test_combobox_messages ( void )
{
HWND parent , combo ;
LRESULT ret ;
subclass_combobox ( ) ;
parent = CreateWindowExA ( 0 , " TestParentClass " , " Test parent " , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( parent ! = 0 , " Failed to create parent window \n " ) ;
flush_sequence ( ) ;
combo = CreateWindowEx ( 0 , " my_combobox_class " , " test " , WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | CBS_HASSTRINGS ,
0 , 0 , 100 , 150 , parent , ( HMENU ) ID_COMBOBOX , 0 , NULL ) ;
ok ( combo ! = 0 , " Failed to create combobox window \n " ) ;
UpdateWindow ( combo ) ;
ret = SendMessage ( combo , WM_GETDLGCODE , 0 , 0 ) ;
ok ( ret = = ( DLGC_WANTCHARS | DLGC_WANTARROWS ) , " wrong dlg_code %08lx \n " , ret ) ;
ret = SendMessage ( combo , CB_ADDSTRING , 0 , ( LPARAM ) " item 0 " ) ;
ok ( ret = = 0 , " expected 0, got %ld \n " , ret ) ;
ret = SendMessage ( combo , CB_ADDSTRING , 0 , ( LPARAM ) " item 1 " ) ;
ok ( ret = = 1 , " expected 1, got %ld \n " , ret ) ;
ret = SendMessage ( combo , CB_ADDSTRING , 0 , ( LPARAM ) " item 2 " ) ;
ok ( ret = = 2 , " expected 2, got %ld \n " , ret ) ;
SendMessage ( combo , CB_SETCURSEL , 0 , 0 ) ;
SetFocus ( combo ) ;
flush_sequence ( ) ;
log_all_parent_messages + + ;
SendMessage ( combo , WM_KEYDOWN , VK_DOWN , 0 ) ;
SendMessage ( combo , WM_KEYUP , VK_DOWN , 0 ) ;
log_all_parent_messages - - ;
ok_sequence ( WmKeyDownComboSeq , " WM_KEYDOWN/VK_DOWN on a ComboBox " , FALSE ) ;
DestroyWindow ( combo ) ;
DestroyWindow ( parent ) ;
}
2008-04-30 13:50:19 +02:00
/****************** WM_IME_KEYDOWN message test *******************/
static const struct message WmImeKeydownMsgSeq_0 [ ] =
{
{ WM_IME_KEYDOWN , wparam , VK_RETURN } ,
{ WM_CHAR , wparam , ' A ' } ,
{ 0 }
} ;
static const struct message WmImeKeydownMsgSeq_1 [ ] =
{
2008-08-04 23:07:10 +02:00
{ WM_KEYDOWN , optional | wparam , VK_RETURN } ,
{ WM_CHAR , optional | wparam , VK_RETURN } ,
2008-04-30 13:50:19 +02:00
{ 0 }
} ;
static LRESULT WINAPI wmime_keydown_procA ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2008-04-30 13:50:19 +02:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2008-04-30 13:50:19 +02:00
msg . message = message ;
msg . flags = wparam | lparam ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " wmime_keydown " ;
2008-04-30 13:50:19 +02:00
add_message ( & msg ) ;
return DefWindowProcA ( hwnd , message , wParam , lParam ) ;
}
static void register_wmime_keydown_class ( void )
{
WNDCLASSA cls ;
ZeroMemory ( & cls , sizeof ( WNDCLASSA ) ) ;
cls . lpfnWndProc = wmime_keydown_procA ;
cls . hInstance = GetModuleHandleA ( 0 ) ;
cls . lpszClassName = " wmime_keydown_class " ;
if ( ! RegisterClassA ( & cls ) ) assert ( 0 ) ;
}
2008-12-12 10:22:24 +01:00
static void test_wmime_keydown_message ( void )
2008-04-30 13:50:19 +02:00
{
HWND hwnd ;
MSG msg ;
trace ( " Message sequences by WM_IME_KEYDOWN \n " ) ;
register_wmime_keydown_class ( ) ;
hwnd = CreateWindowExA ( 0 , " wmime_keydown_class " , NULL , WS_OVERLAPPEDWINDOW ,
CW_USEDEFAULT , CW_USEDEFAULT , 300 , 300 , 0 ,
NULL , NULL , 0 ) ;
flush_events ( ) ;
flush_sequence ( ) ;
SendMessage ( hwnd , WM_IME_KEYDOWN , VK_RETURN , 0x1c0001 ) ;
SendMessage ( hwnd , WM_CHAR , ' A ' , 1 ) ;
ok_sequence ( WmImeKeydownMsgSeq_0 , " WM_IME_KEYDOWN 0 " , FALSE ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
ok_sequence ( WmImeKeydownMsgSeq_1 , " WM_IME_KEYDOWN 1 " , FALSE ) ;
DestroyWindow ( hwnd ) ;
}
2004-08-26 02:49:06 +02:00
/************* painting message test ********************/
2005-03-25 18:11:04 +01:00
void dump_region ( HRGN hrgn )
2004-08-26 02:49:06 +02:00
{
DWORD i , size ;
RGNDATA * data = NULL ;
RECT * rect ;
if ( ! hrgn )
{
printf ( " null region \n " ) ;
return ;
}
if ( ! ( size = GetRegionData ( hrgn , 0 , NULL ) ) ) return ;
if ( ! ( data = HeapAlloc ( GetProcessHeap ( ) , 0 , size ) ) ) return ;
GetRegionData ( hrgn , size , data ) ;
2006-10-07 21:45:11 +02:00
printf ( " %d rects: " , data - > rdh . nCount ) ;
2004-08-26 02:49:06 +02:00
for ( i = 0 , rect = ( RECT * ) data - > Buffer ; i < data - > rdh . nCount ; i + + , rect + + )
2006-10-07 21:45:11 +02:00
printf ( " (%d,%d)-(%d,%d) " , rect - > left , rect - > top , rect - > right , rect - > bottom ) ;
2004-08-26 02:49:06 +02:00
printf ( " \n " ) ;
HeapFree ( GetProcessHeap ( ) , 0 , data ) ;
}
static void check_update_rgn ( HWND hwnd , HRGN hrgn )
{
INT ret ;
RECT r1 , r2 ;
HRGN tmp = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
HRGN update = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
ret = GetUpdateRgn ( hwnd , update , FALSE ) ;
ok ( ret ! = ERROR , " GetUpdateRgn failed \n " ) ;
if ( ret = = NULLREGION )
{
ok ( ! hrgn , " Update region shouldn't be empty \n " ) ;
}
else
{
if ( CombineRgn ( tmp , hrgn , update , RGN_XOR ) ! = NULLREGION )
{
ok ( 0 , " Regions are different \n " ) ;
if ( winetest_debug > 0 )
{
printf ( " Update region: " ) ;
dump_region ( update ) ;
printf ( " Wanted region: " ) ;
dump_region ( hrgn ) ;
}
}
}
GetRgnBox ( update , & r1 ) ;
GetUpdateRect ( hwnd , & r2 , FALSE ) ;
ok ( r1 . left = = r2 . left & & r1 . top = = r2 . top & & r1 . right = = r2 . right & & r1 . bottom = = r2 . bottom ,
2006-10-07 21:45:11 +02:00
" Rectangles are different: %d,%d-%d,%d / %d,%d-%d,%d \n " ,
2004-08-26 02:49:06 +02:00
r1 . left , r1 . top , r1 . right , r1 . bottom , r2 . left , r2 . top , r2 . right , r2 . bottom ) ;
DeleteObject ( tmp ) ;
DeleteObject ( update ) ;
}
static const struct message WmInvalidateRgn [ ] = {
{ WM_NCPAINT , sent } ,
2004-08-26 20:21:56 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2004-08-26 02:49:06 +02:00
{ 0 }
} ;
2004-12-07 18:34:19 +01:00
static const struct message WmGetUpdateRect [ ] = {
{ WM_NCPAINT , sent } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_PAINT , sent } ,
{ 0 }
} ;
2004-08-26 02:49:06 +02:00
static const struct message WmInvalidateFull [ ] = {
{ WM_NCPAINT , sent | wparam , 1 } ,
2004-08-26 20:21:56 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2004-08-26 02:49:06 +02:00
{ 0 }
} ;
static const struct message WmInvalidateErase [ ] = {
{ WM_NCPAINT , sent | wparam , 1 } ,
2004-08-26 20:21:56 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2004-08-26 02:49:06 +02:00
{ WM_ERASEBKGND , sent } ,
{ 0 }
} ;
static const struct message WmInvalidatePaint [ ] = {
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | wparam | beginpaint , 1 } ,
2004-08-26 20:21:56 +02:00
{ WM_GETTEXT , sent | beginpaint | defwinproc | optional } ,
2004-08-26 02:49:06 +02:00
{ 0 }
} ;
static const struct message WmInvalidateErasePaint [ ] = {
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | wparam | beginpaint , 1 } ,
2004-08-26 20:21:56 +02:00
{ WM_GETTEXT , sent | beginpaint | defwinproc | optional } ,
2009-03-03 13:20:49 +01:00
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2004-08-26 02:49:06 +02:00
{ 0 }
} ;
2004-12-07 18:34:19 +01:00
static const struct message WmInvalidateErasePaint2 [ ] = {
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | beginpaint } ,
{ WM_GETTEXT , sent | beginpaint | defwinproc | optional } ,
2009-01-15 15:43:58 +01:00
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2004-12-07 18:34:19 +01:00
{ 0 }
} ;
2004-08-26 02:49:06 +02:00
static const struct message WmErase [ ] = {
{ WM_ERASEBKGND , sent } ,
{ 0 }
} ;
static const struct message WmPaint [ ] = {
{ WM_PAINT , sent } ,
{ 0 }
} ;
2004-12-07 18:34:19 +01:00
static const struct message WmParentOnlyPaint [ ] = {
{ WM_PAINT , sent | parent } ,
{ 0 }
} ;
static const struct message WmInvalidateParent [ ] = {
{ WM_NCPAINT , sent | parent } ,
{ WM_GETTEXT , sent | defwinproc | parent | optional } ,
{ WM_ERASEBKGND , sent | parent } ,
{ 0 }
} ;
static const struct message WmInvalidateParentChild [ ] = {
{ WM_NCPAINT , sent | parent } ,
{ WM_GETTEXT , sent | defwinproc | parent | optional } ,
{ WM_ERASEBKGND , sent | parent } ,
{ WM_NCPAINT , sent } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent } ,
{ 0 }
} ;
static const struct message WmInvalidateParentChild2 [ ] = {
{ WM_ERASEBKGND , sent | parent } ,
{ WM_NCPAINT , sent } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent } ,
{ 0 }
} ;
static const struct message WmParentPaint [ ] = {
{ WM_PAINT , sent | parent } ,
{ WM_PAINT , sent } ,
{ 0 }
} ;
static const struct message WmParentPaintNc [ ] = {
{ WM_PAINT , sent | parent } ,
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | beginpaint } ,
{ WM_GETTEXT , sent | beginpaint | defwinproc | optional } ,
2009-01-15 15:43:58 +01:00
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2004-12-07 18:34:19 +01:00
{ 0 }
} ;
static const struct message WmChildPaintNc [ ] = {
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | beginpaint } ,
{ WM_GETTEXT , sent | beginpaint | defwinproc | optional } ,
2009-03-03 13:20:49 +01:00
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2004-12-07 18:34:19 +01:00
{ 0 }
} ;
static const struct message WmParentErasePaint [ ] = {
{ WM_PAINT , sent | parent } ,
{ WM_NCPAINT , sent | parent | beginpaint } ,
{ WM_GETTEXT , sent | parent | beginpaint | defwinproc | optional } ,
2009-01-15 15:43:58 +01:00
{ WM_ERASEBKGND , sent | parent | beginpaint | optional } ,
2004-12-07 18:34:19 +01:00
{ WM_PAINT , sent } ,
{ WM_NCPAINT , sent | beginpaint } ,
{ WM_GETTEXT , sent | beginpaint | defwinproc | optional } ,
2009-01-20 14:02:02 +01:00
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2004-12-07 18:34:19 +01:00
{ 0 }
} ;
static const struct message WmParentOnlyNcPaint [ ] = {
{ WM_PAINT , sent | parent } ,
{ WM_NCPAINT , sent | parent | beginpaint } ,
{ WM_GETTEXT , sent | parent | beginpaint | defwinproc | optional } ,
{ 0 }
} ;
static const struct message WmSetParentStyle [ ] = {
{ WM_STYLECHANGING , sent | parent } ,
{ WM_STYLECHANGED , sent | parent } ,
{ 0 }
} ;
2004-08-26 02:49:06 +02:00
static void test_paint_messages ( void )
{
2005-11-30 19:46:00 +01:00
BOOL ret ;
2004-08-26 02:49:06 +02:00
RECT rect ;
2004-12-07 18:34:19 +01:00
POINT pt ;
2004-09-02 22:13:19 +02:00
MSG msg ;
2004-12-07 18:34:19 +01:00
HWND hparent , hchild ;
2004-08-26 02:49:06 +02:00
HRGN hrgn = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
HRGN hrgn2 = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
HWND hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test overlapped " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
2006-03-15 12:11:02 +01:00
flush_events ( ) ;
2007-01-07 12:40:46 +01:00
flush_sequence ( ) ;
2004-12-07 18:34:19 +01:00
2004-08-26 02:49:06 +02:00
check_update_rgn ( hwnd , 0 ) ;
SetRectRgn ( hrgn , 10 , 10 , 20 , 20 ) ;
2005-11-30 19:46:00 +01:00
ret = RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE ) ;
ok ( ret , " RedrawWindow returned %d instead of TRUE \n " , ret ) ;
2004-08-26 02:49:06 +02:00
check_update_rgn ( hwnd , hrgn ) ;
SetRectRgn ( hrgn2 , 20 , 20 , 30 , 30 ) ;
2005-11-30 19:46:00 +01:00
ret = RedrawWindow ( hwnd , NULL , hrgn2 , RDW_INVALIDATE ) ;
ok ( ret , " RedrawWindow returned %d instead of TRUE \n " , ret ) ;
2004-08-26 02:49:06 +02:00
CombineRgn ( hrgn , hrgn , hrgn2 , RGN_OR ) ;
check_update_rgn ( hwnd , hrgn ) ;
/* validate everything */
2005-11-30 19:46:00 +01:00
ret = RedrawWindow ( hwnd , NULL , NULL , RDW_VALIDATE ) ;
ok ( ret , " RedrawWindow returned %d instead of TRUE \n " , ret ) ;
check_update_rgn ( hwnd , 0 ) ;
/* test empty region */
SetRectRgn ( hrgn , 10 , 10 , 10 , 15 ) ;
ret = RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE ) ;
ok ( ret , " RedrawWindow returned %d instead of TRUE \n " , ret ) ;
check_update_rgn ( hwnd , 0 ) ;
/* test empty rect */
SetRect ( & rect , 10 , 10 , 10 , 15 ) ;
ret = RedrawWindow ( hwnd , & rect , NULL , RDW_INVALIDATE ) ;
ok ( ret , " RedrawWindow returned %d instead of TRUE \n " , ret ) ;
2004-08-26 02:49:06 +02:00
check_update_rgn ( hwnd , 0 ) ;
2005-10-31 16:45:16 +01:00
/* flush pending messages */
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-10-31 16:45:16 +01:00
flush_sequence ( ) ;
GetClientRect ( hwnd , & rect ) ;
SetRectRgn ( hrgn , 0 , 0 , rect . right - rect . left , rect . bottom - rect . top ) ;
/* MSDN: if hwnd parameter is NULL, InvalidateRect invalidates and redraws
* all windows and sends WM_ERASEBKGND and WM_NCPAINT .
*/
trace ( " testing InvalidateRect(0, NULL, FALSE) \n " ) ;
SetRectEmpty ( & rect ) ;
ok ( InvalidateRect ( 0 , & rect , FALSE ) , " InvalidateRect(0, &rc, FALSE) should fail \n " ) ;
check_update_rgn ( hwnd , hrgn ) ;
ok_sequence ( WmInvalidateErase , " InvalidateErase " , FALSE ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-10-31 16:45:16 +01:00
ok_sequence ( WmPaint , " Paint " , FALSE ) ;
RedrawWindow ( hwnd , NULL , NULL , RDW_VALIDATE ) ;
check_update_rgn ( hwnd , 0 ) ;
/* MSDN: if hwnd parameter is NULL, ValidateRect invalidates and redraws
* all windows and sends WM_ERASEBKGND and WM_NCPAINT .
*/
trace ( " testing ValidateRect(0, NULL) \n " ) ;
SetRectEmpty ( & rect ) ;
2009-01-20 14:02:02 +01:00
if ( ValidateRect ( 0 , & rect ) ) /* not supported on Win9x */
{
check_update_rgn ( hwnd , hrgn ) ;
ok_sequence ( WmInvalidateErase , " InvalidateErase " , FALSE ) ;
flush_events ( ) ;
ok_sequence ( WmPaint , " Paint " , FALSE ) ;
RedrawWindow ( hwnd , NULL , NULL , RDW_VALIDATE ) ;
check_update_rgn ( hwnd , 0 ) ;
}
2005-10-31 16:45:16 +01:00
trace ( " testing InvalidateRgn(0, NULL, FALSE) \n " ) ;
SetLastError ( 0xdeadbeef ) ;
ok ( ! InvalidateRgn ( 0 , NULL , FALSE ) , " InvalidateRgn(0, NULL, FALSE) should fail \n " ) ;
2008-03-04 20:00:13 +01:00
ok ( GetLastError ( ) = = ERROR_INVALID_WINDOW_HANDLE | | GetLastError ( ) = = 0xdeadbeef ,
" wrong error code %d \n " , GetLastError ( ) ) ;
2005-10-31 16:45:16 +01:00
check_update_rgn ( hwnd , 0 ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-10-31 16:45:16 +01:00
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
trace ( " testing ValidateRgn(0, NULL) \n " ) ;
SetLastError ( 0xdeadbeef ) ;
2005-11-10 12:17:38 +01:00
ok ( ! ValidateRgn ( 0 , NULL ) , " ValidateRgn(0, NULL) should fail \n " ) ;
2008-10-17 19:05:11 +02:00
ok ( GetLastError ( ) = = ERROR_INVALID_WINDOW_HANDLE | |
broken ( GetLastError ( ) = = 0xdeadbeef ) /* win9x */ ,
" wrong error code %d \n " , GetLastError ( ) ) ;
2005-10-31 16:45:16 +01:00
check_update_rgn ( hwnd , 0 ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-10-31 16:45:16 +01:00
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2010-09-28 18:56:40 +02:00
trace ( " testing UpdateWindow(NULL) \n " ) ;
SetLastError ( 0xdeadbeef ) ;
ok ( ! UpdateWindow ( NULL ) , " UpdateWindow(NULL) should fail \n " ) ;
ok ( GetLastError ( ) = = ERROR_INVALID_WINDOW_HANDLE | |
broken ( GetLastError ( ) = = 0xdeadbeef ) /* win9x */ ,
" wrong error code %d \n " , GetLastError ( ) ) ;
check_update_rgn ( hwnd , 0 ) ;
flush_events ( ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2004-08-26 02:49:06 +02:00
/* now with frame */
SetRectRgn ( hrgn , - 5 , - 5 , 20 , 20 ) ;
2004-10-27 23:18:01 +02:00
/* flush pending messages */
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-08-26 02:49:06 +02:00
flush_sequence ( ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE | RDW_FRAME ) ;
ok_sequence ( WmEmptySeq , " EmptySeq " , FALSE ) ;
SetRectRgn ( hrgn , 0 , 0 , 20 , 20 ) ; /* GetUpdateRgn clips to client area */
check_update_rgn ( hwnd , hrgn ) ;
flush_sequence ( ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE | RDW_FRAME | RDW_ERASENOW ) ;
ok_sequence ( WmInvalidateRgn , " InvalidateRgn " , FALSE ) ;
flush_sequence ( ) ;
RedrawWindow ( hwnd , NULL , NULL , RDW_INVALIDATE | RDW_FRAME | RDW_ERASENOW ) ;
ok_sequence ( WmInvalidateFull , " InvalidateFull " , FALSE ) ;
GetClientRect ( hwnd , & rect ) ;
SetRectRgn ( hrgn , rect . left , rect . top , rect . right , rect . bottom ) ;
check_update_rgn ( hwnd , hrgn ) ;
flush_sequence ( ) ;
RedrawWindow ( hwnd , NULL , NULL , RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ERASENOW ) ;
ok_sequence ( WmInvalidateErase , " InvalidateErase " , FALSE ) ;
flush_sequence ( ) ;
RedrawWindow ( hwnd , NULL , NULL , RDW_INVALIDATE | RDW_FRAME | RDW_ERASENOW | RDW_UPDATENOW ) ;
2004-12-20 17:59:26 +01:00
ok_sequence ( WmInvalidatePaint , " InvalidatePaint " , FALSE ) ;
2004-08-26 02:49:06 +02:00
check_update_rgn ( hwnd , 0 ) ;
flush_sequence ( ) ;
RedrawWindow ( hwnd , NULL , NULL , RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_UPDATENOW ) ;
ok_sequence ( WmInvalidateErasePaint , " InvalidateErasePaint " , FALSE ) ;
check_update_rgn ( hwnd , 0 ) ;
flush_sequence ( ) ;
SetRectRgn ( hrgn , 0 , 0 , 100 , 100 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE ) ;
SetRectRgn ( hrgn , 0 , 0 , 50 , 100 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_VALIDATE ) ;
SetRectRgn ( hrgn , 50 , 0 , 100 , 100 ) ;
check_update_rgn ( hwnd , hrgn ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_VALIDATE | RDW_ERASENOW ) ;
ok_sequence ( WmEmptySeq , " EmptySeq " , FALSE ) ; /* must not generate messages, everything is valid */
check_update_rgn ( hwnd , 0 ) ;
flush_sequence ( ) ;
SetRectRgn ( hrgn , 0 , 0 , 100 , 100 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE | RDW_ERASE ) ;
SetRectRgn ( hrgn , 0 , 0 , 100 , 50 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_VALIDATE | RDW_ERASENOW ) ;
ok_sequence ( WmErase , " Erase " , FALSE ) ;
SetRectRgn ( hrgn , 0 , 50 , 100 , 100 ) ;
check_update_rgn ( hwnd , hrgn ) ;
flush_sequence ( ) ;
SetRectRgn ( hrgn , 0 , 0 , 100 , 100 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE | RDW_ERASE ) ;
SetRectRgn ( hrgn , 0 , 0 , 50 , 50 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_VALIDATE | RDW_NOERASE | RDW_UPDATENOW ) ;
2004-12-20 17:59:26 +01:00
ok_sequence ( WmPaint , " Paint " , FALSE ) ;
2004-08-26 02:49:06 +02:00
2004-09-02 22:13:19 +02:00
flush_sequence ( ) ;
SetRectRgn ( hrgn , - 4 , - 4 , - 2 , - 2 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE | RDW_FRAME ) ;
2004-12-07 18:34:19 +01:00
SetRectRgn ( hrgn , - 200 , - 200 , - 198 , - 198 ) ;
2004-09-02 22:13:19 +02:00
RedrawWindow ( hwnd , NULL , hrgn , RDW_VALIDATE | RDW_NOFRAME | RDW_ERASENOW ) ;
ok_sequence ( WmEmptySeq , " EmptySeq " , FALSE ) ;
flush_sequence ( ) ;
SetRectRgn ( hrgn , - 4 , - 4 , - 2 , - 2 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE | RDW_FRAME ) ;
SetRectRgn ( hrgn , - 4 , - 4 , - 3 , - 3 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_VALIDATE | RDW_NOFRAME ) ;
SetRectRgn ( hrgn , 0 , 0 , 1 , 1 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE | RDW_UPDATENOW ) ;
2004-12-20 17:59:26 +01:00
ok_sequence ( WmPaint , " Paint " , FALSE ) ;
2004-09-02 22:13:19 +02:00
flush_sequence ( ) ;
SetRectRgn ( hrgn , - 4 , - 4 , - 1 , - 1 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE | RDW_FRAME ) ;
RedrawWindow ( hwnd , NULL , 0 , RDW_ERASENOW ) ;
/* make sure no WM_PAINT was generated */
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-09-02 22:13:19 +02:00
ok_sequence ( WmInvalidateRgn , " InvalidateRgn " , FALSE ) ;
flush_sequence ( ) ;
SetRectRgn ( hrgn , - 4 , - 4 , - 1 , - 1 ) ;
RedrawWindow ( hwnd , NULL , hrgn , RDW_INVALIDATE | RDW_FRAME ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) )
{
if ( msg . hwnd = = hwnd & & msg . message = = WM_PAINT )
{
/* GetUpdateRgn must return empty region since only nonclient area is invalidated */
INT ret = GetUpdateRgn ( hwnd , hrgn , FALSE ) ;
ok ( ret = = NULLREGION , " Invalid GetUpdateRgn result %d \n " , ret ) ;
ret = GetUpdateRect ( hwnd , & rect , FALSE ) ;
ok ( ret , " Invalid GetUpdateRect result %d \n " , ret ) ;
/* this will send WM_NCPAINT and validate the non client area */
ret = GetUpdateRect ( hwnd , & rect , TRUE ) ;
ok ( ! ret , " Invalid GetUpdateRect result %d \n " , ret ) ;
}
2004-12-07 18:34:19 +01:00
DispatchMessage ( & msg ) ;
2004-09-02 22:13:19 +02:00
}
2004-12-07 18:34:19 +01:00
ok_sequence ( WmGetUpdateRect , " GetUpdateRect " , FALSE ) ;
DestroyWindow ( hwnd ) ;
/* now test with a child window */
hparent = CreateWindowExA ( 0 , " TestParentClass " , " Test parent " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hparent ! = 0 , " Failed to create parent window \n " ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD | WS_VISIBLE | WS_BORDER ,
10 , 10 , 100 , 100 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child window \n " ) ;
ShowWindow ( hparent , SW_SHOW ) ;
UpdateWindow ( hparent ) ;
UpdateWindow ( hchild ) ;
2006-03-15 12:11:02 +01:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
flush_sequence ( ) ;
log_all_parent_messages + + ;
SetRect ( & rect , 0 , 0 , 50 , 50 ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_ERASENOW | RDW_ALLCHILDREN ) ;
ok_sequence ( WmInvalidateParentChild , " InvalidateParentChild " , FALSE ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
pt . x = pt . y = 0 ;
MapWindowPoints ( hchild , hparent , & pt , 1 ) ;
SetRectRgn ( hrgn , 0 , 0 , 50 - pt . x , 50 - pt . y ) ;
check_update_rgn ( hchild , hrgn ) ;
SetRectRgn ( hrgn , 0 , 0 , 50 , 50 ) ;
check_update_rgn ( hparent , hrgn ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_ERASENOW ) ;
ok_sequence ( WmInvalidateParent , " InvalidateParent " , FALSE ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_ERASENOW ) ;
ok_sequence ( WmEmptySeq , " EraseNow child " , FALSE ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
ok_sequence ( WmParentPaintNc , " WmParentPaintNc " , FALSE ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_ERASENOW ) ;
ok_sequence ( WmInvalidateParent , " InvalidateParent2 " , FALSE ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_ERASENOW ) ;
ok_sequence ( WmEmptySeq , " EraseNow child " , FALSE ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_ERASENOW | RDW_ALLCHILDREN ) ;
ok_sequence ( WmInvalidateParentChild2 , " InvalidateParentChild2 " , FALSE ) ;
SetWindowLong ( hparent , GWL_STYLE , GetWindowLong ( hparent , GWL_STYLE ) | WS_CLIPCHILDREN ) ;
flush_sequence ( ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_ERASENOW ) ;
ok_sequence ( WmInvalidateParentChild , " InvalidateParentChild3 " , FALSE ) ;
/* flush all paint messages */
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
flush_sequence ( ) ;
/* RDW_UPDATENOW on child with WS_CLIPCHILDREN doesn't change corresponding parent area */
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ) ;
SetRectRgn ( hrgn , 0 , 0 , 50 , 50 ) ;
check_update_rgn ( hparent , hrgn ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_UPDATENOW ) ;
ok_sequence ( WmInvalidateErasePaint2 , " WmInvalidateErasePaint2 " , FALSE ) ;
SetRectRgn ( hrgn , 0 , 0 , 50 , 50 ) ;
check_update_rgn ( hparent , hrgn ) ;
/* flush all paint messages */
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
SetWindowLong ( hparent , GWL_STYLE , GetWindowLong ( hparent , GWL_STYLE ) & ~ WS_CLIPCHILDREN ) ;
flush_sequence ( ) ;
/* RDW_UPDATENOW on child without WS_CLIPCHILDREN will validate corresponding parent area */
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
SetRectRgn ( hrgn , 0 , 0 , 50 , 50 ) ;
check_update_rgn ( hparent , hrgn ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_UPDATENOW ) ;
ok_sequence ( WmInvalidateErasePaint2 , " WmInvalidateErasePaint2 " , FALSE ) ;
SetRectRgn ( hrgn2 , 10 , 10 , 50 , 50 ) ;
CombineRgn ( hrgn , hrgn , hrgn2 , RGN_DIFF ) ;
check_update_rgn ( hparent , hrgn ) ;
/* flush all paint messages */
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
flush_sequence ( ) ;
/* same as above but parent gets completely validated */
SetRect ( & rect , 20 , 20 , 30 , 30 ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
SetRectRgn ( hrgn , 20 , 20 , 30 , 30 ) ;
check_update_rgn ( hparent , hrgn ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_UPDATENOW ) ;
ok_sequence ( WmInvalidateErasePaint2 , " WmInvalidateErasePaint2 " , FALSE ) ;
check_update_rgn ( hparent , 0 ) ; /* no update region */
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
ok_sequence ( WmEmptySeq , " WmEmpty " , FALSE ) ; /* and no paint messages */
/* make sure RDW_VALIDATE on child doesn't have the same effect */
flush_sequence ( ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
SetRectRgn ( hrgn , 20 , 20 , 30 , 30 ) ;
check_update_rgn ( hparent , hrgn ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_VALIDATE | RDW_NOERASE ) ;
SetRectRgn ( hrgn , 20 , 20 , 30 , 30 ) ;
check_update_rgn ( hparent , hrgn ) ;
/* same as above but normal WM_PAINT doesn't validate parent */
flush_sequence ( ) ;
SetRect ( & rect , 20 , 20 , 30 , 30 ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
SetRectRgn ( hrgn , 20 , 20 , 30 , 30 ) ;
check_update_rgn ( hparent , hrgn ) ;
/* no WM_PAINT in child while parent still pending */
while ( PeekMessage ( & msg , hchild , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( WmEmptySeq , " No WM_PAINT " , FALSE ) ;
while ( PeekMessage ( & msg , hparent , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( WmParentErasePaint , " WmParentErasePaint " , FALSE ) ;
flush_sequence ( ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
/* no WM_PAINT in child while parent still pending */
while ( PeekMessage ( & msg , hchild , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( WmEmptySeq , " No WM_PAINT " , FALSE ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_VALIDATE | RDW_NOERASE | RDW_NOCHILDREN ) ;
/* now that parent is valid child should get WM_PAINT */
while ( PeekMessage ( & msg , hchild , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( WmInvalidateErasePaint2 , " WmInvalidateErasePaint2 " , FALSE ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( WmEmptySeq , " No other message " , FALSE ) ;
/* same thing with WS_CLIPCHILDREN in parent */
flush_sequence ( ) ;
SetWindowLong ( hparent , GWL_STYLE , GetWindowLong ( hparent , GWL_STYLE ) | WS_CLIPCHILDREN ) ;
ok_sequence ( WmSetParentStyle , " WmSetParentStyle " , FALSE ) ;
/* changing style invalidates non client area, but we need to invalidate something else to see it */
RedrawWindow ( hparent , & rect , 0 , RDW_UPDATENOW ) ;
ok_sequence ( WmEmptySeq , " No message " , FALSE ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_UPDATENOW ) ;
ok_sequence ( WmParentOnlyNcPaint , " WmParentOnlyNcPaint " , FALSE ) ;
flush_sequence ( ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN ) ;
SetRectRgn ( hrgn , 20 , 20 , 30 , 30 ) ;
check_update_rgn ( hparent , hrgn ) ;
/* no WM_PAINT in child while parent still pending */
while ( PeekMessage ( & msg , hchild , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( WmEmptySeq , " No WM_PAINT " , FALSE ) ;
/* WM_PAINT in parent first */
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( WmParentPaintNc , " WmParentPaintNc2 " , FALSE ) ;
/* no RDW_ERASE in parent still causes RDW_ERASE and RDW_FRAME in child */
flush_sequence ( ) ;
SetRect ( & rect , 0 , 0 , 30 , 30 ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ALLCHILDREN ) ;
SetRectRgn ( hrgn , 0 , 0 , 30 , 30 ) ;
check_update_rgn ( hparent , hrgn ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
ok_sequence ( WmParentPaintNc , " WmParentPaintNc3 " , FALSE ) ;
/* validate doesn't cause RDW_NOERASE or RDW_NOFRAME in child */
flush_sequence ( ) ;
SetRect ( & rect , - 10 , 0 , 30 , 30 ) ;
RedrawWindow ( hchild , & rect , 0 , RDW_INVALIDATE | RDW_FRAME | RDW_ERASE ) ;
SetRect ( & rect , 0 , 0 , 20 , 20 ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_VALIDATE | RDW_ALLCHILDREN ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_UPDATENOW ) ;
ok_sequence ( WmChildPaintNc , " WmChildPaintNc " , FALSE ) ;
/* validate doesn't cause RDW_NOERASE or RDW_NOFRAME in child */
flush_sequence ( ) ;
SetRect ( & rect , - 10 , 0 , 30 , 30 ) ;
RedrawWindow ( hchild , & rect , 0 , RDW_INVALIDATE | RDW_FRAME | RDW_ERASE ) ;
SetRect ( & rect , 0 , 0 , 100 , 100 ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_VALIDATE | RDW_ALLCHILDREN ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_UPDATENOW ) ;
ok_sequence ( WmEmptySeq , " WmChildPaintNc2 " , FALSE ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_ERASENOW ) ;
ok_sequence ( WmEmptySeq , " WmChildPaintNc3 " , FALSE ) ;
/* test RDW_INTERNALPAINT behavior */
flush_sequence ( ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_INTERNALPAINT | RDW_NOCHILDREN ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
ok_sequence ( WmParentOnlyPaint , " WmParentOnlyPaint " , FALSE ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_INTERNALPAINT | RDW_ALLCHILDREN ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
ok_sequence ( WmParentPaint , " WmParentPaint " , FALSE ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_INTERNALPAINT ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
ok_sequence ( WmParentOnlyPaint , " WmParentOnlyPaint " , FALSE ) ;
2005-09-28 17:13:10 +02:00
assert ( GetWindowLong ( hparent , GWL_STYLE ) & WS_CLIPCHILDREN ) ;
UpdateWindow ( hparent ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
flush_sequence ( ) ;
trace ( " testing SWP_FRAMECHANGED on parent with WS_CLIPCHILDREN \n " ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
SetWindowPos ( hparent , 0 , 0 , 0 , 0 , 0 , SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
ok_sequence ( WmSWP_FrameChanged_clip , " SetWindowPos:FrameChanged_clip " , FALSE ) ;
UpdateWindow ( hparent ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
flush_sequence ( ) ;
trace ( " testing SWP_FRAMECHANGED|SWP_DEFERERASE on parent with WS_CLIPCHILDREN \n " ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
SetWindowPos ( hparent , 0 , 0 , 0 , 0 , 0 , SWP_NOSIZE | SWP_NOMOVE | SWP_DEFERERASE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
ok_sequence ( WmSWP_FrameChangedDeferErase , " SetWindowPos:FrameChangedDeferErase " , FALSE ) ;
2004-12-07 18:34:19 +01:00
SetWindowLong ( hparent , GWL_STYLE , GetWindowLong ( hparent , GWL_STYLE ) & ~ WS_CLIPCHILDREN ) ;
ok_sequence ( WmSetParentStyle , " WmSetParentStyle " , FALSE ) ;
RedrawWindow ( hparent , NULL , 0 , RDW_INTERNALPAINT ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
ok_sequence ( WmParentPaint , " WmParentPaint " , FALSE ) ;
2005-09-28 17:13:10 +02:00
assert ( ! ( GetWindowLong ( hparent , GWL_STYLE ) & WS_CLIPCHILDREN ) ) ;
UpdateWindow ( hparent ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
flush_sequence ( ) ;
trace ( " testing SWP_FRAMECHANGED on parent without WS_CLIPCHILDREN \n " ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
SetWindowPos ( hparent , 0 , 0 , 0 , 0 , 0 , SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
ok_sequence ( WmSWP_FrameChanged_noclip , " SetWindowPos:FrameChanged_noclip " , FALSE ) ;
UpdateWindow ( hparent ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
flush_sequence ( ) ;
trace ( " testing SWP_FRAMECHANGED|SWP_DEFERERASE on parent without WS_CLIPCHILDREN \n " ) ;
RedrawWindow ( hchild , NULL , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
SetWindowPos ( hparent , 0 , 0 , 0 , 0 , 0 , SWP_NOSIZE | SWP_NOMOVE | SWP_DEFERERASE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-28 17:13:10 +02:00
ok_sequence ( WmSWP_FrameChangedDeferErase , " SetWindowPos:FrameChangedDeferErase " , FALSE ) ;
2008-05-13 06:16:30 +02:00
ok ( GetWindowLong ( hparent , GWL_STYLE ) & WS_VISIBLE , " parent should be visible \n " ) ;
ok ( GetWindowLong ( hchild , GWL_STYLE ) & WS_VISIBLE , " child should be visible \n " ) ;
UpdateWindow ( hparent ) ;
flush_events ( ) ;
flush_sequence ( ) ;
trace ( " testing SetWindowPos(-10000, -10000) on child \n " ) ;
SetWindowPos ( hchild , 0 , - 10000 , - 10000 , 0 , 0 , SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER ) ;
check_update_rgn ( hchild , 0 ) ;
flush_events ( ) ;
#if 0 /* this one doesn't pass under Wine yet */
UpdateWindow ( hparent ) ;
flush_events ( ) ;
flush_sequence ( ) ;
trace ( " testing ShowWindow(SW_MINIMIZE) on child \n " ) ;
ShowWindow ( hchild , SW_MINIMIZE ) ;
check_update_rgn ( hchild , 0 ) ;
flush_events ( ) ;
# endif
UpdateWindow ( hparent ) ;
flush_events ( ) ;
flush_sequence ( ) ;
trace ( " testing SetWindowPos(-10000, -10000) on parent \n " ) ;
SetWindowPos ( hparent , 0 , - 10000 , - 10000 , 0 , 0 , SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER ) ;
check_update_rgn ( hparent , 0 ) ;
flush_events ( ) ;
2004-12-07 18:34:19 +01:00
log_all_parent_messages - - ;
DestroyWindow ( hparent ) ;
2005-02-18 21:01:41 +01:00
ok ( ! IsWindow ( hchild ) , " child must be destroyed with its parent \n " ) ;
2004-09-02 22:13:19 +02:00
2008-05-12 12:26:26 +02:00
/* tests for moving windows off-screen (needs simple WS_POPUP windows) */
hparent = CreateWindowExA ( 0 , " TestParentClass " , " Test parent " , WS_POPUP | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hparent ! = 0 , " Failed to create parent window \n " ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " , WS_CHILD | WS_VISIBLE ,
10 , 10 , 100 , 100 , hparent , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child window \n " ) ;
ShowWindow ( hparent , SW_SHOW ) ;
UpdateWindow ( hparent ) ;
UpdateWindow ( hchild ) ;
flush_events ( ) ;
flush_sequence ( ) ;
/* moving child outside of parent boundaries changes update region */
SetRect ( & rect , 0 , 0 , 40 , 40 ) ;
RedrawWindow ( hchild , & rect , 0 , RDW_INVALIDATE | RDW_ERASE ) ;
SetRectRgn ( hrgn , 0 , 0 , 40 , 40 ) ;
check_update_rgn ( hchild , hrgn ) ;
MoveWindow ( hchild , - 10 , 10 , 100 , 100 , FALSE ) ;
SetRectRgn ( hrgn , 10 , 0 , 40 , 40 ) ;
check_update_rgn ( hchild , hrgn ) ;
MoveWindow ( hchild , - 10 , - 10 , 100 , 100 , FALSE ) ;
SetRectRgn ( hrgn , 10 , 10 , 40 , 40 ) ;
check_update_rgn ( hchild , hrgn ) ;
2008-05-12 12:28:57 +02:00
/* moving parent off-screen does too */
SetRect ( & rect , 0 , 0 , 100 , 100 ) ;
RedrawWindow ( hparent , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_NOCHILDREN ) ;
SetRectRgn ( hrgn , 0 , 0 , 100 , 100 ) ;
check_update_rgn ( hparent , hrgn ) ;
SetRectRgn ( hrgn , 10 , 10 , 40 , 40 ) ;
check_update_rgn ( hchild , hrgn ) ;
MoveWindow ( hparent , - 20 , - 20 , 200 , 200 , FALSE ) ;
SetRectRgn ( hrgn , 20 , 20 , 100 , 100 ) ;
check_update_rgn ( hparent , hrgn ) ;
SetRectRgn ( hrgn , 30 , 30 , 40 , 40 ) ;
check_update_rgn ( hchild , hrgn ) ;
2008-05-12 12:29:56 +02:00
/* invalidated region is cropped by the parent rects */
SetRect ( & rect , 0 , 0 , 50 , 50 ) ;
RedrawWindow ( hchild , & rect , 0 , RDW_INVALIDATE | RDW_ERASE ) ;
SetRectRgn ( hrgn , 30 , 30 , 50 , 50 ) ;
check_update_rgn ( hchild , hrgn ) ;
2008-05-12 12:26:26 +02:00
DestroyWindow ( hparent ) ;
ok ( ! IsWindow ( hchild ) , " child must be destroyed with its parent \n " ) ;
flush_sequence ( ) ;
2004-08-26 02:49:06 +02:00
DeleteObject ( hrgn ) ;
DeleteObject ( hrgn2 ) ;
}
2004-10-06 00:35:00 +02:00
struct wnd_event
{
HWND hwnd ;
2009-06-03 20:33:45 +02:00
HANDLE grand_child ;
HANDLE start_event ;
HANDLE stop_event ;
2004-10-06 00:35:00 +02:00
} ;
static DWORD WINAPI thread_proc ( void * param )
{
MSG msg ;
2009-02-05 09:53:39 +01:00
struct wnd_event * wnd_event = param ;
2004-10-06 00:35:00 +02:00
wnd_event - > hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " window caption text " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( wnd_event - > hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
2009-06-03 20:33:45 +02:00
SetEvent ( wnd_event - > start_event ) ;
2004-10-06 00:35:00 +02:00
while ( GetMessage ( & msg , 0 , 0 , 0 ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
2005-01-11 11:38:31 +01:00
ok ( IsWindow ( wnd_event - > hwnd ) , " window should still exist \n " ) ;
2004-10-06 00:35:00 +02:00
return 0 ;
}
2009-06-03 11:31:10 +02:00
static DWORD CALLBACK create_grand_child_thread ( void * param )
{
struct wnd_event * wnd_event = param ;
HWND hchild ;
MSG msg ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " ,
WS_CHILD | WS_VISIBLE , 0 , 0 , 10 , 10 , wnd_event - > hwnd , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child window \n " ) ;
flush_events ( ) ;
flush_sequence ( ) ;
2009-06-03 20:33:45 +02:00
SetEvent ( wnd_event - > start_event ) ;
2009-06-03 11:31:10 +02:00
2009-06-03 20:33:45 +02:00
for ( ; ; )
2009-06-03 11:31:10 +02:00
{
2009-06-03 20:33:45 +02:00
MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 1000 , QS_ALLINPUT ) ;
2009-06-03 11:31:10 +02:00
if ( ! IsWindow ( hchild ) ) break ; /* will be destroyed when parent thread exits */
2009-06-03 20:33:45 +02:00
while ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
2009-06-03 11:31:10 +02:00
}
return 0 ;
}
static DWORD CALLBACK create_child_thread ( void * param )
{
struct wnd_event * wnd_event = param ;
struct wnd_event child_event ;
2009-06-03 20:33:45 +02:00
DWORD ret , tid ;
2009-06-03 11:31:10 +02:00
MSG msg ;
child_event . hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " ,
WS_CHILD | WS_VISIBLE , 0 , 0 , 10 , 10 , wnd_event - > hwnd , 0 , 0 , NULL ) ;
ok ( child_event . hwnd ! = 0 , " Failed to create child window \n " ) ;
SetFocus ( child_event . hwnd ) ;
flush_events ( ) ;
flush_sequence ( ) ;
2009-06-03 20:33:45 +02:00
child_event . start_event = wnd_event - > start_event ;
wnd_event - > grand_child = CreateThread ( NULL , 0 , create_grand_child_thread , & child_event , 0 , & tid ) ;
2009-06-03 11:31:10 +02:00
for ( ; ; )
{
2009-06-03 20:33:45 +02:00
DWORD ret = MsgWaitForMultipleObjects ( 1 , & child_event . start_event , FALSE , 1000 , QS_SENDMESSAGE ) ;
2009-06-03 11:31:10 +02:00
if ( ret ! = 1 ) break ;
while ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
}
2009-06-03 20:33:45 +02:00
ret = WaitForSingleObject ( wnd_event - > stop_event , 5000 ) ;
ok ( ! ret , " WaitForSingleObject failed %x \n " , ret ) ;
2009-06-03 11:31:10 +02:00
return 0 ;
}
2004-10-06 00:35:00 +02:00
static void test_interthread_messages ( void )
{
HANDLE hThread ;
DWORD tid ;
WNDPROC proc ;
MSG msg ;
char buf [ 256 ] ;
int len , expected_len ;
struct wnd_event wnd_event ;
2004-12-27 18:26:37 +01:00
BOOL ret ;
2004-10-06 00:35:00 +02:00
2009-06-03 20:33:45 +02:00
wnd_event . start_event = CreateEventW ( NULL , 0 , 0 , NULL ) ;
if ( ! wnd_event . start_event )
2004-10-06 20:51:27 +02:00
{
2009-02-23 10:41:03 +01:00
win_skip ( " skipping interthread message test under win9x \n " ) ;
2004-10-06 20:51:27 +02:00
return ;
}
2004-10-06 00:35:00 +02:00
hThread = CreateThread ( NULL , 0 , thread_proc , & wnd_event , 0 , & tid ) ;
2006-10-07 21:45:11 +02:00
ok ( hThread ! = NULL , " CreateThread failed, error %d \n " , GetLastError ( ) ) ;
2004-10-06 00:35:00 +02:00
2009-06-03 20:33:45 +02:00
ok ( WaitForSingleObject ( wnd_event . start_event , INFINITE ) = = WAIT_OBJECT_0 , " WaitForSingleObject failed \n " ) ;
2004-10-06 00:35:00 +02:00
2009-06-03 20:33:45 +02:00
CloseHandle ( wnd_event . start_event ) ;
2004-10-06 00:35:00 +02:00
SetLastError ( 0xdeadbeef ) ;
ok ( ! DestroyWindow ( wnd_event . hwnd ) , " DestroyWindow succeded \n " ) ;
2008-03-04 20:00:13 +01:00
ok ( GetLastError ( ) = = ERROR_ACCESS_DENIED | | GetLastError ( ) = = 0xdeadbeef ,
" wrong error code %d \n " , GetLastError ( ) ) ;
2004-10-06 00:35:00 +02:00
proc = ( WNDPROC ) GetWindowLongPtrA ( wnd_event . hwnd , GWLP_WNDPROC ) ;
2006-10-07 21:45:11 +02:00
ok ( proc ! = NULL , " GetWindowLongPtrA(GWLP_WNDPROC) error %d \n " , GetLastError ( ) ) ;
2004-10-06 00:35:00 +02:00
expected_len = lstrlenA ( " window caption text " ) ;
memset ( buf , 0 , sizeof ( buf ) ) ;
SetLastError ( 0xdeadbeef ) ;
len = CallWindowProcA ( proc , wnd_event . hwnd , WM_GETTEXT , sizeof ( buf ) , ( LPARAM ) buf ) ;
2006-10-07 21:45:11 +02:00
ok ( len = = expected_len , " CallWindowProcA(WM_GETTEXT) error %d, len %d, expected len %d \n " , GetLastError ( ) , len , expected_len ) ;
2004-10-06 00:35:00 +02:00
ok ( ! lstrcmpA ( buf , " window caption text " ) , " window text mismatch \n " ) ;
msg . hwnd = wnd_event . hwnd ;
msg . message = WM_GETTEXT ;
msg . wParam = sizeof ( buf ) ;
msg . lParam = ( LPARAM ) buf ;
memset ( buf , 0 , sizeof ( buf ) ) ;
SetLastError ( 0xdeadbeef ) ;
len = DispatchMessageA ( & msg ) ;
2008-08-04 23:07:10 +02:00
ok ( ( ! len & & GetLastError ( ) = = ERROR_MESSAGE_SYNC_ONLY ) | | broken ( len ) , /* nt4 */
2006-10-07 21:45:11 +02:00
" DispatchMessageA(WM_GETTEXT) succeded on another thread window: ret %d, error %d \n " , len , GetLastError ( ) ) ;
2004-10-06 00:35:00 +02:00
2004-10-06 20:51:27 +02:00
/* the following test causes an exception in user.exe under win9x */
2004-10-06 00:35:00 +02:00
msg . hwnd = wnd_event . hwnd ;
msg . message = WM_TIMER ;
msg . wParam = 0 ;
2004-10-06 20:51:27 +02:00
msg . lParam = GetWindowLongPtrA ( wnd_event . hwnd , GWLP_WNDPROC ) ;
2004-10-06 00:35:00 +02:00
SetLastError ( 0xdeadbeef ) ;
len = DispatchMessageA ( & msg ) ;
ok ( ! len & & GetLastError ( ) = = 0xdeadbeef ,
2006-10-07 21:45:11 +02:00
" DispatchMessageA(WM_TIMER) failed on another thread window: ret %d, error %d \n " , len , GetLastError ( ) ) ;
2004-10-06 00:35:00 +02:00
2004-12-27 18:26:37 +01:00
ret = PostMessageA ( wnd_event . hwnd , WM_QUIT , 0 , 0 ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " PostMessageA(WM_QUIT) error %d \n " , GetLastError ( ) ) ;
2004-10-06 00:35:00 +02:00
ok ( WaitForSingleObject ( hThread , INFINITE ) = = WAIT_OBJECT_0 , " WaitForSingleObject failed \n " ) ;
CloseHandle ( hThread ) ;
2005-01-11 11:38:31 +01:00
ok ( ! IsWindow ( wnd_event . hwnd ) , " window should be destroyed on thread exit \n " ) ;
2009-06-03 11:31:10 +02:00
wnd_event . hwnd = CreateWindowExA ( 0 , " TestParentClass " , " Test parent " , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( wnd_event . hwnd ! = 0 , " Failed to create parent window \n " ) ;
flush_sequence ( ) ;
log_all_parent_messages + + ;
2009-06-03 20:33:45 +02:00
wnd_event . start_event = CreateEventA ( NULL , TRUE , FALSE , NULL ) ;
wnd_event . stop_event = CreateEventA ( NULL , TRUE , FALSE , NULL ) ;
2009-06-03 11:31:10 +02:00
hThread = CreateThread ( NULL , 0 , create_child_thread , & wnd_event , 0 , & tid ) ;
for ( ; ; )
{
2009-06-03 20:33:45 +02:00
ret = MsgWaitForMultipleObjects ( 1 , & wnd_event . start_event , FALSE , 1000 , QS_SENDMESSAGE ) ;
2009-06-03 11:31:10 +02:00
if ( ret ! = 1 ) break ;
while ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
}
ok ( ! ret , " MsgWaitForMultipleObjects failed %x \n " , ret ) ;
/* now wait for the thread without processing messages; this shouldn't deadlock */
2009-06-03 20:33:45 +02:00
SetEvent ( wnd_event . stop_event ) ;
2009-06-03 11:31:10 +02:00
ret = WaitForSingleObject ( hThread , 5000 ) ;
ok ( ! ret , " WaitForSingleObject failed %x \n " , ret ) ;
CloseHandle ( hThread ) ;
2009-06-03 20:33:45 +02:00
ret = WaitForSingleObject ( wnd_event . grand_child , 5000 ) ;
ok ( ! ret , " WaitForSingleObject failed %x \n " , ret ) ;
CloseHandle ( wnd_event . grand_child ) ;
CloseHandle ( wnd_event . start_event ) ;
CloseHandle ( wnd_event . stop_event ) ;
2009-06-03 11:31:10 +02:00
flush_events ( ) ;
ok_sequence ( WmExitThreadSeq , " destroy child on thread exit " , FALSE ) ;
log_all_parent_messages - - ;
DestroyWindow ( wnd_event . hwnd ) ;
2004-10-06 00:35:00 +02:00
}
2004-08-26 02:49:06 +02:00
2004-10-06 01:45:35 +02:00
static const struct message WmVkN [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 1 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYDOWN , wparam | lparam , ' N ' , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , ' N ' , 1 } ,
2004-10-06 01:45:35 +02:00
{ WM_CHAR , wparam | lparam , ' n ' , 1 } ,
{ WM_COMMAND , sent | wparam | lparam , MAKEWPARAM ( 1002 , 1 ) , 0 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xc0000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYUP , wparam | lparam , ' N ' , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , ' N ' , 0xc0000001 } ,
2004-10-06 01:45:35 +02:00
{ 0 }
} ;
static const struct message WmShiftVkN [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 1 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYDOWN , wparam | lparam , VK_SHIFT , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_SHIFT , 1 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 1 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYDOWN , wparam | lparam , ' N ' , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , ' N ' , 1 } ,
2004-10-06 01:45:35 +02:00
{ WM_CHAR , wparam | lparam , ' N ' , 1 } ,
{ WM_COMMAND , sent | wparam | lparam , MAKEWPARAM ( 1001 , 1 ) , 0 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xc0000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYUP , wparam | lparam , ' N ' , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , ' N ' , 0xc0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 0xc0000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYUP , wparam | lparam , VK_SHIFT , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_SHIFT , 0xc0000001 } ,
{ 0 }
} ;
static const struct message WmCtrlVkN [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 1 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYDOWN , wparam | lparam , VK_CONTROL , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_CONTROL , 1 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 1 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYDOWN , wparam | lparam , ' N ' , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , ' N ' , 1 } ,
2004-10-06 01:45:35 +02:00
{ WM_CHAR , wparam | lparam , 0x000e , 1 } ,
{ WM_COMMAND , sent | wparam | lparam , MAKEWPARAM ( 1000 , 1 ) , 0 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xc0000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYUP , wparam | lparam , ' N ' , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , ' N ' , 0xc0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 0xc0000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYUP , wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ 0 }
} ;
static const struct message WmCtrlVkN_2 [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 1 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYDOWN , wparam | lparam , VK_CONTROL , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_CONTROL , 1 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 1 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYDOWN , wparam | lparam , ' N ' , 1 } ,
2004-10-06 01:45:35 +02:00
{ WM_COMMAND , sent | wparam | lparam , MAKEWPARAM ( 1000 , 1 ) , 0 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xc0000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYUP , wparam | lparam , ' N ' , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , ' N ' , 0xc0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 0xc0000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYUP , wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ 0 }
} ;
static const struct message WmAltVkN [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0x20000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_SYSKEYDOWN , wparam | lparam , VK_MENU , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , VK_MENU , 0x20000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0x20000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_SYSKEYDOWN , wparam | lparam , ' N ' , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , ' N ' , 0x20000001 } ,
2004-10-06 01:45:35 +02:00
{ WM_SYSCHAR , wparam | lparam , ' n ' , 0x20000001 } ,
{ WM_SYSCHAR , sent | wparam | lparam , ' n ' , 0x20000001 } ,
{ WM_SYSCOMMAND , sent | defwinproc | wparam | lparam , SC_KEYMENU , ' n ' } ,
{ HCBT_SYSCOMMAND , hook } ,
{ WM_ENTERMENULOOP , sent | defwinproc | wparam | lparam , 0 , 0 } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
2005-11-14 12:24:06 +01:00
{ 0x00AE , sent | defwinproc | optional } , /* XP */
{ WM_GETTEXT , sent | defwinproc | optional } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_INITMENU , sent | defwinproc } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_MENUSTART , winevent_hook | wparam | lparam , OBJID_SYSMENU , 0 } ,
2004-10-06 01:45:35 +02:00
{ WM_MENUCHAR , sent | defwinproc | wparam , MAKEWPARAM ( ' n ' , MF_SYSMENU ) } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_CAPTUREEND , winevent_hook | wparam | lparam , 0 , 0 } ,
2004-10-06 01:45:35 +02:00
{ WM_CAPTURECHANGED , sent | defwinproc } ,
{ WM_MENUSELECT , sent | defwinproc | wparam , MAKEWPARAM ( 0 , 0xffff ) } ,
2005-01-06 21:43:34 +01:00
{ EVENT_SYSTEM_MENUEND , winevent_hook | wparam | lparam , OBJID_SYSMENU , 0 } ,
2004-10-06 01:45:35 +02:00
{ WM_EXITMENULOOP , sent | defwinproc } ,
{ WM_MENUSELECT , sent | defwinproc | wparam | optional , MAKEWPARAM ( 0 , 0xffff ) } , /* Win95 bug */
{ WM_EXITMENULOOP , sent | defwinproc | optional } , /* Win95 bug */
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xe0000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_SYSKEYUP , wparam | lparam , ' N ' , 0xe0000001 } ,
{ WM_SYSKEYUP , sent | wparam | lparam , ' N ' , 0xe0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0xc0000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYUP , wparam | lparam , VK_MENU , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_MENU , 0xc0000001 } ,
{ 0 }
} ;
static const struct message WmAltVkN_2 [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0x20000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_SYSKEYDOWN , wparam | lparam , VK_MENU , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , VK_MENU , 0x20000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0x20000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_SYSKEYDOWN , wparam | lparam , ' N ' , 0x20000001 } ,
2004-10-06 01:45:35 +02:00
{ WM_COMMAND , sent | wparam | lparam , MAKEWPARAM ( 1003 , 1 ) , 0 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xe0000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_SYSKEYUP , wparam | lparam , ' N ' , 0xe0000001 } ,
{ WM_SYSKEYUP , sent | wparam | lparam , ' N ' , 0xe0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0xc0000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYUP , wparam | lparam , VK_MENU , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_MENU , 0xc0000001 } ,
{ 0 }
} ;
static const struct message WmCtrlAltVkN [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 1 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYDOWN , wparam | lparam , VK_CONTROL , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_CONTROL , 1 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0x20000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYDOWN , wparam | lparam , VK_MENU , 0x20000001 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_MENU , 0x20000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0x20000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYDOWN , wparam | lparam , ' N ' , 0x20000001 } ,
{ WM_KEYDOWN , sent | wparam | lparam , ' N ' , 0x20000001 } ,
2009-01-25 17:29:05 +01:00
{ WM_CHAR , optional } ,
{ WM_CHAR , sent | optional } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xe0000001 } , /* XP */
2004-10-22 22:29:10 +02:00
{ WM_KEYUP , wparam | lparam , ' N ' , 0xe0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , ' N ' , 0xe0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0xc0000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYUP , wparam | lparam , VK_MENU , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_MENU , 0xc0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 0xc0000001 } , /* XP */
2004-10-06 01:45:35 +02:00
{ WM_KEYUP , wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ 0 }
} ;
2005-02-21 19:33:27 +01:00
static const struct message WmCtrlShiftVkN [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 1 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYDOWN , wparam | lparam , VK_CONTROL , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_CONTROL , 1 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 1 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYDOWN , wparam | lparam , VK_SHIFT , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_SHIFT , 1 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 1 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYDOWN , wparam | lparam , ' N ' , 1 } ,
{ WM_COMMAND , sent | wparam | lparam , MAKEWPARAM ( 1004 , 1 ) , 0 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xc0000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYUP , wparam | lparam , ' N ' , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , ' N ' , 0xc0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 0xc0000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYUP , wparam | lparam , VK_SHIFT , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_SHIFT , 0xc0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 0xc0000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYUP , wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ 0 }
} ;
static const struct message WmCtrlAltShiftVkN [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 1 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYDOWN , wparam | lparam , VK_CONTROL , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_CONTROL , 1 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0x20000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYDOWN , wparam | lparam , VK_MENU , 0x20000001 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_MENU , 0x20000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 0x20000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYDOWN , wparam | lparam , VK_SHIFT , 0x20000001 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_SHIFT , 0x20000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0x20000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYDOWN , wparam | lparam , ' N ' , 0x20000001 } ,
{ WM_COMMAND , sent | wparam | lparam , MAKEWPARAM ( 1005 , 1 ) , 0 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xe0000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYUP , wparam | lparam , ' N ' , 0xe0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , ' N ' , 0xe0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 0xe0000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYUP , wparam | lparam , VK_SHIFT , 0xe0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_SHIFT , 0xe0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0xc0000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYUP , wparam | lparam , VK_MENU , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_MENU , 0xc0000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_CONTROL , 0xc0000001 } , /* XP */
2005-02-21 19:33:27 +01:00
{ WM_KEYUP , wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_CONTROL , 0xc0000001 } ,
{ 0 }
} ;
2005-01-11 11:38:31 +01:00
static const struct message WmAltPressRelease [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0x20000001 } , /* XP */
2005-01-11 11:38:31 +01:00
{ WM_SYSKEYDOWN , wparam | lparam , VK_MENU , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , VK_MENU , 0x20000001 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0xc0000001 } , /* XP */
2005-01-11 11:38:31 +01:00
{ WM_SYSKEYUP , wparam | lparam , VK_MENU , 0xc0000001 } ,
{ WM_SYSKEYUP , sent | wparam | lparam , VK_MENU , 0xc0000001 } ,
{ WM_SYSCOMMAND , sent | defwinproc | wparam | lparam , SC_KEYMENU , 0 } ,
{ HCBT_SYSCOMMAND , hook } ,
{ WM_ENTERMENULOOP , sent | defwinproc | wparam | lparam , 0 , 0 } ,
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_INITMENU , sent | defwinproc } ,
{ EVENT_SYSTEM_MENUSTART , winevent_hook | wparam | lparam , OBJID_SYSMENU , 0 } ,
{ WM_MENUSELECT , sent | defwinproc | wparam , MAKEWPARAM ( 0 , MF_SYSMENU | MF_POPUP | MF_HILITE ) } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_SYSMENU , 1 } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0x30000001 } , /* XP */
2005-01-11 11:38:31 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_SYSMENU , 0 } ,
{ EVENT_SYSTEM_CAPTUREEND , winevent_hook | wparam | lparam , 0 , 0 , } ,
{ WM_CAPTURECHANGED , sent | defwinproc } ,
{ WM_MENUSELECT , sent | defwinproc | wparam | optional , MAKEWPARAM ( 0 , 0xffff ) } ,
{ EVENT_SYSTEM_MENUEND , winevent_hook | wparam | lparam , OBJID_SYSMENU , 0 } ,
{ WM_EXITMENULOOP , sent | defwinproc } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0xc0000001 } , /* XP */
2005-01-11 11:38:31 +01:00
{ WM_SYSKEYUP , wparam | lparam , VK_MENU , 0xc0000001 } ,
{ WM_SYSKEYUP , sent | wparam | lparam , VK_MENU , 0xc0000001 } ,
{ 0 }
} ;
2009-02-11 14:21:51 +01:00
static const struct message WmShiftMouseButton [ ] = {
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 1 } , /* XP */
{ WM_KEYDOWN , wparam | lparam , VK_SHIFT , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_SHIFT , 1 } ,
2005-01-11 11:38:31 +01:00
{ WM_MOUSEMOVE , wparam | optional , 0 , 0 } ,
{ WM_MOUSEMOVE , sent | wparam | optional , 0 , 0 } ,
2009-02-11 14:21:51 +01:00
{ WM_LBUTTONDOWN , wparam , MK_LBUTTON | MK_SHIFT , 0 } ,
{ WM_LBUTTONDOWN , sent | wparam , MK_LBUTTON | MK_SHIFT , 0 } ,
{ WM_LBUTTONUP , wparam , MK_SHIFT , 0 } ,
{ WM_LBUTTONUP , sent | wparam , MK_SHIFT , 0 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 0xc0000001 } , /* XP */
{ WM_KEYUP , wparam | lparam , VK_SHIFT , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_SHIFT , 0xc0000001 } ,
2005-01-11 11:38:31 +01:00
{ 0 }
} ;
2005-10-27 14:31:04 +02:00
static const struct message WmF1Seq [ ] = {
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_F1 , 1 } , /* XP */
2005-10-27 14:31:04 +02:00
{ WM_KEYDOWN , wparam | lparam , VK_F1 , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_F1 , 0x00000001 } ,
2008-03-22 20:09:21 +01:00
{ WM_KEYF1 , wparam | lparam , 0 , 0 } ,
{ WM_KEYF1 , sent | wparam | lparam , 0 , 0 } ,
2005-10-27 14:31:04 +02:00
{ WM_HELP , sent | defwinproc } ,
2006-10-28 10:24:13 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_F1 , 0xc0000001 } , /* XP */
2005-10-27 14:31:04 +02:00
{ WM_KEYUP , wparam | lparam , VK_F1 , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_F1 , 0xc0000001 } ,
{ 0 }
} ;
2006-12-15 08:03:43 +01:00
static const struct message WmVkAppsSeq [ ] = {
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_APPS , 1 } , /* XP */
{ WM_KEYDOWN , wparam | lparam , VK_APPS , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_APPS , 0x00000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_APPS , 0xc0000001 } , /* XP */
{ WM_KEYUP , wparam | lparam , VK_APPS , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_APPS , 0xc0000001 } ,
2009-12-27 14:40:19 +01:00
{ WM_CONTEXTMENU , lparam , /*hwnd*/ 0 , - 1 } ,
{ WM_CONTEXTMENU , sent | lparam , /*hwnd*/ 0 , - 1 } ,
2006-12-15 08:03:43 +01:00
{ 0 }
} ;
2009-10-13 02:49:57 +02:00
static const struct message WmVkF10Seq [ ] = {
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_F10 , 1 } , /* XP */
{ WM_SYSKEYDOWN , wparam | lparam , VK_F10 , 1 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , VK_F10 , 0x00000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_F10 , 0xc0000001 } , /* XP */
{ WM_SYSKEYUP , wparam | lparam , VK_F10 , 0xc0000001 } ,
{ WM_SYSKEYUP , sent | wparam | lparam , VK_F10 , 0xc0000001 } ,
{ WM_SYSCOMMAND , sent | defwinproc | wparam , SC_KEYMENU } ,
{ HCBT_SYSCOMMAND , hook } ,
{ WM_ENTERMENULOOP , sent | defwinproc | wparam | lparam , 0 , 0 } ,
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_INITMENU , sent | defwinproc } ,
{ EVENT_SYSTEM_MENUSTART , winevent_hook | wparam | lparam , OBJID_SYSMENU , 0 } ,
{ WM_MENUSELECT , sent | defwinproc | wparam , MAKEWPARAM ( 0 , MF_SYSMENU | MF_POPUP | MF_HILITE ) } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_SYSMENU , 1 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_F10 , 0x10000001 } , /* XP */
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_F10 , 1 } , /* XP */
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_SYSMENU , 0 } ,
{ EVENT_SYSTEM_CAPTUREEND , winevent_hook | wparam | lparam , 0 , 0 , } ,
{ WM_CAPTURECHANGED , sent | defwinproc } ,
{ WM_MENUSELECT , sent | defwinproc | wparam | optional , MAKEWPARAM ( 0 , 0xffff ) } ,
{ EVENT_SYSTEM_MENUEND , winevent_hook | wparam | lparam , OBJID_SYSMENU , 0 } ,
{ WM_EXITMENULOOP , sent | defwinproc } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_F10 , 0xc0000001 } , /* XP */
{ WM_SYSKEYUP , wparam | lparam , VK_F10 , 0xc0000001 } ,
{ WM_SYSKEYUP , sent | wparam | lparam , VK_F10 , 0xc0000001 } ,
{ 0 }
} ;
2010-01-13 14:55:05 +01:00
static const struct message WmShiftF10Seq [ ] = {
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 1 } , /* XP */
{ WM_KEYDOWN , wparam | lparam , VK_SHIFT , 1 } ,
{ WM_KEYDOWN , sent | wparam | lparam , VK_SHIFT , 0x00000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_F10 , 1 } , /* XP */
{ WM_SYSKEYDOWN , wparam | lparam , VK_F10 , 1 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , VK_F10 , 0x00000001 } ,
2010-02-02 23:44:10 +01:00
{ WM_CONTEXTMENU , sent | defwinproc | lparam , /*hwnd*/ 0 , - 1 } ,
2010-01-13 14:55:05 +01:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_F10 , 0xc0000001 } , /* XP */
{ WM_SYSKEYUP , wparam | lparam , VK_F10 , 0xc0000001 } ,
{ WM_SYSKEYUP , sent | wparam | lparam , VK_F10 , 0xc0000001 } ,
{ WM_SYSCOMMAND , sent | defwinproc | wparam , SC_KEYMENU } ,
{ HCBT_SYSCOMMAND , hook } ,
{ WM_ENTERMENULOOP , sent | defwinproc | wparam | lparam , 0 , 0 } ,
{ WM_INITMENU , sent | defwinproc } ,
{ WM_MENUSELECT , sent | defwinproc | wparam , MAKEWPARAM ( 0 , MF_SYSMENU | MF_POPUP | MF_HILITE ) } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_SHIFT , 0xd0000001 } , /* XP */
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_ESCAPE , 0x10000001 } , /* XP */
{ WM_CAPTURECHANGED , sent | defwinproc | wparam | lparam , 0 , 0 } ,
{ WM_MENUSELECT , sent | defwinproc | wparam | lparam , 0xffff0000 , 0 } ,
{ WM_EXITMENULOOP , sent | defwinproc | wparam | lparam , 0 , 0 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_ESCAPE , 0xc0000001 } , /* XP */
{ WM_KEYUP , wparam | lparam , VK_ESCAPE , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_ESCAPE , 0xc0000001 } ,
{ 0 }
} ;
2004-10-06 01:45:35 +02:00
static void pump_msg_loop ( HWND hwnd , HACCEL hAccel )
{
MSG msg ;
while ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) )
{
2009-01-12 21:03:57 +01:00
struct recvd_message log_msg ;
2004-10-06 01:45:35 +02:00
2005-01-11 11:38:31 +01:00
/* ignore some unwanted messages */
2005-02-18 21:01:41 +01:00
if ( msg . message = = WM_MOUSEMOVE | |
2008-09-15 11:29:58 +02:00
msg . message = = WM_TIMER | |
2009-05-12 12:09:30 +02:00
ignore_message ( msg . message ) )
2005-01-11 11:38:31 +01:00
continue ;
2009-01-12 21:03:57 +01:00
log_msg . hwnd = msg . hwnd ;
2004-10-06 01:45:35 +02:00
log_msg . message = msg . message ;
log_msg . flags = wparam | lparam ;
log_msg . wParam = msg . wParam ;
log_msg . lParam = msg . lParam ;
2009-01-12 21:03:57 +01:00
log_msg . descr = " accel " ;
2004-10-06 01:45:35 +02:00
add_message ( & log_msg ) ;
2005-01-11 11:38:31 +01:00
if ( ! hAccel | | ! TranslateAccelerator ( hwnd , hAccel , & msg ) )
2004-10-06 01:45:35 +02:00
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
}
}
static void test_accelerators ( void )
{
2005-01-11 11:38:31 +01:00
RECT rc ;
2009-02-13 13:02:08 +01:00
POINT pt ;
2004-10-06 01:45:35 +02:00
SHORT state ;
HACCEL hAccel ;
2005-01-11 11:38:31 +01:00
HWND hwnd = CreateWindowExA ( 0 , " TestWindowClass " , NULL , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
2004-10-06 01:45:35 +02:00
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
2004-12-27 18:26:37 +01:00
BOOL ret ;
2004-10-06 01:45:35 +02:00
2004-12-27 18:26:37 +01:00
assert ( hwnd ! = 0 ) ;
2005-01-11 11:38:31 +01:00
UpdateWindow ( hwnd ) ;
2006-03-15 12:11:02 +01:00
flush_events ( ) ;
2007-01-07 12:40:46 +01:00
flush_sequence ( ) ;
2004-10-06 01:45:35 +02:00
SetFocus ( hwnd ) ;
ok ( GetFocus ( ) = = hwnd , " wrong focus window %p \n " , GetFocus ( ) ) ;
state = GetKeyState ( VK_SHIFT ) ;
ok ( ! ( state & 0x8000 ) , " wrong Shift state %04x \n " , state ) ;
state = GetKeyState ( VK_CAPITAL ) ;
ok ( state = = 0 , " wrong CapsLock state %04x \n " , state ) ;
hAccel = LoadAccelerators ( GetModuleHandleA ( 0 ) , MAKEINTRESOURCE ( 1 ) ) ;
assert ( hAccel ! = 0 ) ;
2008-08-04 23:07:10 +02:00
flush_events ( ) ;
2005-01-11 11:38:31 +01:00
pump_msg_loop ( hwnd , 0 ) ;
flush_sequence ( ) ;
2004-10-06 01:45:35 +02:00
trace ( " testing VK_N press/release \n " ) ;
flush_sequence ( ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
pump_msg_loop ( hwnd , hAccel ) ;
2009-02-17 14:57:57 +01:00
if ( ! sequence_cnt ) /* we didn't get any message */
{
skip ( " queuing key events not supported \n " ) ;
goto done ;
}
2004-10-06 01:45:35 +02:00
ok_sequence ( WmVkN , " VK_N press/release " , FALSE ) ;
trace ( " testing Shift+VK_N press/release \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_SHIFT , 0 , 0 , 0 ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
keybd_event ( VK_SHIFT , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmShiftVkN , " Shift+VK_N press/release " , FALSE ) ;
trace ( " testing Ctrl+VK_N press/release \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_CONTROL , 0 , 0 , 0 ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
keybd_event ( VK_CONTROL , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmCtrlVkN , " Ctrl+VK_N press/release " , FALSE ) ;
trace ( " testing Alt+VK_N press/release \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmAltVkN , " Alt+VK_N press/release " , FALSE ) ;
2005-02-21 19:33:27 +01:00
trace ( " testing Ctrl+Alt+VK_N press/release 1 \n " ) ;
2004-10-06 01:45:35 +02:00
flush_sequence ( ) ;
keybd_event ( VK_CONTROL , 0 , 0 , 0 ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_CONTROL , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmCtrlAltVkN , " Ctrl+Alt+VK_N press/release 1 " , FALSE ) ;
2004-12-27 18:26:37 +01:00
ret = DestroyAcceleratorTable ( hAccel ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " DestroyAcceleratorTable error %d \n " , GetLastError ( ) ) ;
2004-10-06 01:45:35 +02:00
hAccel = LoadAccelerators ( GetModuleHandleA ( 0 ) , MAKEINTRESOURCE ( 2 ) ) ;
assert ( hAccel ! = 0 ) ;
trace ( " testing VK_N press/release \n " ) ;
flush_sequence ( ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmVkN , " VK_N press/release " , FALSE ) ;
trace ( " testing Shift+VK_N press/release \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_SHIFT , 0 , 0 , 0 ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
keybd_event ( VK_SHIFT , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmShiftVkN , " Shift+VK_N press/release " , FALSE ) ;
trace ( " testing Ctrl+VK_N press/release 2 \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_CONTROL , 0 , 0 , 0 ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
keybd_event ( VK_CONTROL , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmCtrlVkN_2 , " Ctrl+VK_N press/release 2 " , FALSE ) ;
trace ( " testing Alt+VK_N press/release 2 \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmAltVkN_2 , " Alt+VK_N press/release 2 " , FALSE ) ;
2005-02-21 19:33:27 +01:00
trace ( " testing Ctrl+Alt+VK_N press/release 2 \n " ) ;
2004-10-06 01:45:35 +02:00
flush_sequence ( ) ;
keybd_event ( VK_CONTROL , 0 , 0 , 0 ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
2004-10-22 22:29:10 +02:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
2004-10-06 01:45:35 +02:00
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_CONTROL , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmCtrlAltVkN , " Ctrl+Alt+VK_N press/release 2 " , FALSE ) ;
2005-02-21 19:33:27 +01:00
trace ( " testing Ctrl+Shift+VK_N press/release \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_CONTROL , 0 , 0 , 0 ) ;
keybd_event ( VK_SHIFT , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_SHIFT , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_CONTROL , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmCtrlShiftVkN , " Ctrl+Shift+VK_N press/release " , FALSE ) ;
trace ( " testing Ctrl+Alt+Shift+VK_N press/release \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_CONTROL , 0 , 0 , 0 ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
keybd_event ( VK_SHIFT , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_SHIFT , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_CONTROL , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , hAccel ) ;
ok_sequence ( WmCtrlAltShiftVkN , " Ctrl+Alt+Shift+VK_N press/release " , FALSE ) ;
2004-12-27 18:26:37 +01:00
ret = DestroyAcceleratorTable ( hAccel ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " DestroyAcceleratorTable error %d \n " , GetLastError ( ) ) ;
2009-02-17 14:57:57 +01:00
hAccel = 0 ;
2004-10-06 01:45:35 +02:00
2005-01-11 11:38:31 +01:00
trace ( " testing Alt press/release \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , 0 ) ;
/* this test doesn't pass in Wine for managed windows */
ok_sequence ( WmAltPressRelease , " Alt press/release " , TRUE ) ;
2009-02-21 12:57:23 +01:00
trace ( " testing VK_F1 press/release \n " ) ;
keybd_event ( VK_F1 , 0 , 0 , 0 ) ;
keybd_event ( VK_F1 , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , 0 ) ;
ok_sequence ( WmF1Seq , " F1 press/release " , FALSE ) ;
trace ( " testing VK_APPS press/release \n " ) ;
keybd_event ( VK_APPS , 0 , 0 , 0 ) ;
keybd_event ( VK_APPS , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , 0 ) ;
ok_sequence ( WmVkAppsSeq , " VK_APPS press/release " , FALSE ) ;
2009-10-13 02:49:57 +02:00
trace ( " testing VK_F10 press/release \n " ) ;
keybd_event ( VK_F10 , 0 , 0 , 0 ) ;
keybd_event ( VK_F10 , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_F10 , 0 , 0 , 0 ) ;
keybd_event ( VK_F10 , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , 0 ) ;
ok_sequence ( WmVkF10Seq , " VK_F10 press/release " , TRUE ) ;
2010-01-13 14:55:05 +01:00
trace ( " testing SHIFT+F10 press/release \n " ) ;
keybd_event ( VK_SHIFT , 0 , 0 , 0 ) ;
keybd_event ( VK_F10 , 0 , 0 , 0 ) ;
keybd_event ( VK_F10 , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_SHIFT , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_ESCAPE , 0 , 0 , 0 ) ;
keybd_event ( VK_ESCAPE , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , 0 ) ;
ok_sequence ( WmShiftF10Seq , " SHIFT+F10 press/release " , TRUE ) ;
2009-02-11 14:21:51 +01:00
trace ( " testing Shift+MouseButton press/release \n " ) ;
2005-01-11 11:38:31 +01:00
/* first, move mouse pointer inside of the window client area */
GetClientRect ( hwnd , & rc ) ;
MapWindowPoints ( hwnd , 0 , ( LPPOINT ) & rc , 2 ) ;
rc . left + = ( rc . right - rc . left ) / 2 ;
rc . top + = ( rc . bottom - rc . top ) / 2 ;
SetCursorPos ( rc . left , rc . top ) ;
2009-02-11 14:21:51 +01:00
SetActiveWindow ( hwnd ) ;
2005-01-11 11:38:31 +01:00
2007-07-11 14:40:19 +02:00
flush_events ( ) ;
2005-01-11 11:38:31 +01:00
flush_sequence ( ) ;
2009-02-13 13:02:08 +01:00
GetCursorPos ( & pt ) ;
if ( pt . x = = rc . left & & pt . y = = rc . top )
{
2009-03-11 11:42:21 +01:00
int i ;
2009-02-13 13:02:08 +01:00
keybd_event ( VK_SHIFT , 0 , 0 , 0 ) ;
mouse_event ( MOUSEEVENTF_LEFTDOWN , 0 , 0 , 0 , 0 ) ;
mouse_event ( MOUSEEVENTF_LEFTUP , 0 , 0 , 0 , 0 ) ;
keybd_event ( VK_SHIFT , 0 , KEYEVENTF_KEYUP , 0 ) ;
pump_msg_loop ( hwnd , 0 ) ;
2009-03-11 11:42:21 +01:00
for ( i = 0 ; i < sequence_cnt ; i + + ) if ( sequence [ i ] . message = = WM_LBUTTONDOWN ) break ;
if ( i < sequence_cnt )
ok_sequence ( WmShiftMouseButton , " Shift+MouseButton press/release " , FALSE ) ;
else
skip ( " Shift+MouseButton event didn't get to the window \n " ) ;
2009-02-13 13:02:08 +01:00
}
2005-01-11 11:38:31 +01:00
2009-02-17 14:57:57 +01:00
done :
if ( hAccel ) DestroyAcceleratorTable ( hAccel ) ;
2004-10-06 01:45:35 +02:00
DestroyWindow ( hwnd ) ;
}
2004-08-26 02:49:06 +02:00
/************* window procedures ********************/
2004-08-10 01:38:40 +02:00
2005-10-18 12:45:18 +02:00
static LRESULT MsgCheckProc ( BOOL unicode , HWND hwnd , UINT message ,
WPARAM wParam , LPARAM lParam )
2003-10-02 06:32:56 +02:00
{
2009-04-22 10:25:30 +02:00
static LONG defwndproc_counter = 0 ;
static LONG beginpaint_counter = 0 ;
2004-04-06 22:09:59 +02:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-03-26 00:35:52 +01:00
2009-05-12 12:09:30 +02:00
if ( ignore_message ( message ) ) return 0 ;
2008-09-15 11:29:58 +02:00
2004-09-13 20:03:09 +02:00
switch ( message )
{
2005-06-07 22:29:09 +02:00
case WM_ENABLE :
{
LONG style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
ok ( ( BOOL ) wParam = = ! ( style & WS_DISABLED ) ,
2007-05-24 16:41:17 +02:00
" wrong WS_DISABLED state: %ld != %d \n " , wParam , ! ( style & WS_DISABLED ) ) ;
2005-06-07 22:29:09 +02:00
break ;
}
2005-03-14 18:15:33 +01:00
case WM_CAPTURECHANGED :
if ( test_DestroyWindow_flag )
{
DWORD style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
if ( style & WS_CHILD )
2005-09-09 17:20:04 +02:00
lParam = GetWindowLongPtrA ( hwnd , GWLP_ID ) ;
2005-03-14 18:15:33 +01:00
else if ( style & WS_POPUP )
lParam = WND_POPUP_ID ;
else
lParam = WND_PARENT_ID ;
}
break ;
2005-02-18 21:01:41 +01:00
case WM_NCDESTROY :
2005-03-14 18:15:33 +01:00
{
HWND capture ;
2005-02-18 21:01:41 +01:00
ok ( ! GetWindow ( hwnd , GW_CHILD ) , " children should be unlinked at this point \n " ) ;
2005-03-14 18:15:33 +01:00
capture = GetCapture ( ) ;
if ( capture )
{
ok ( capture = = hwnd , " capture should NOT be released at this point (capture %p) \n " , capture ) ;
trace ( " current capture %p, releasing... \n " , capture ) ;
ReleaseCapture ( ) ;
}
}
2005-02-18 21:01:41 +01:00
/* fall through */
case WM_DESTROY :
2005-02-22 16:43:54 +01:00
if ( pGetAncestor )
ok ( pGetAncestor ( hwnd , GA_PARENT ) ! = 0 , " parent should NOT be unlinked at this point \n " ) ;
2005-02-18 21:01:41 +01:00
if ( test_DestroyWindow_flag )
{
DWORD style = GetWindowLongA ( hwnd , GWL_STYLE ) ;
if ( style & WS_CHILD )
2005-09-09 17:20:04 +02:00
lParam = GetWindowLongPtrA ( hwnd , GWLP_ID ) ;
2005-02-18 21:01:41 +01:00
else if ( style & WS_POPUP )
lParam = WND_POPUP_ID ;
else
lParam = WND_PARENT_ID ;
}
break ;
2005-01-11 11:38:31 +01:00
/* test_accelerators() depends on this */
case WM_NCHITTEST :
return HTCLIENT ;
2009-01-15 15:43:58 +01:00
2005-01-11 11:38:31 +01:00
/* ignore */
case WM_MOUSEMOVE :
2009-01-15 15:43:58 +01:00
case WM_MOUSEACTIVATE :
case WM_NCMOUSEMOVE :
2005-01-11 11:38:31 +01:00
case WM_SETCURSOR :
2009-01-22 13:11:38 +01:00
case WM_IME_SELECT :
2005-01-11 11:38:31 +01:00
return 0 ;
2004-09-13 20:03:09 +02:00
}
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2004-03-26 00:35:52 +01:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
2004-04-06 22:09:59 +02:00
if ( defwndproc_counter ) msg . flags | = defwinproc ;
2004-08-26 02:49:06 +02:00
if ( beginpaint_counter ) msg . flags | = beginpaint ;
2004-03-26 00:35:52 +01:00
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " MsgCheckProc " ;
2004-03-26 00:35:52 +01:00
add_message ( & msg ) ;
2003-10-02 06:32:56 +02:00
2004-04-29 22:00:40 +02:00
if ( message = = WM_GETMINMAXINFO & & ( GetWindowLongA ( hwnd , GWL_STYLE ) & WS_CHILD ) )
{
HWND parent = GetParent ( hwnd ) ;
RECT rc ;
MINMAXINFO * minmax = ( MINMAXINFO * ) lParam ;
GetClientRect ( parent , & rc ) ;
2006-10-07 21:45:11 +02:00
trace ( " parent %p client size = (%d x %d) \n " , parent , rc . right , rc . bottom ) ;
2008-06-10 11:34:40 +02:00
trace ( " Reserved=%d,%d MaxSize=%d,%d MaxPos=%d,%d MinTrack=%d,%d MaxTrack=%d,%d \n " ,
minmax - > ptReserved . x , minmax - > ptReserved . y ,
minmax - > ptMaxSize . x , minmax - > ptMaxSize . y ,
minmax - > ptMaxPosition . x , minmax - > ptMaxPosition . y ,
minmax - > ptMinTrackSize . x , minmax - > ptMinTrackSize . y ,
minmax - > ptMaxTrackSize . x , minmax - > ptMaxTrackSize . y ) ;
2004-04-29 22:00:40 +02:00
2006-10-07 21:45:11 +02:00
ok ( minmax - > ptMaxSize . x = = rc . right , " default width of maximized child %d != %d \n " ,
2004-04-29 22:00:40 +02:00
minmax - > ptMaxSize . x , rc . right ) ;
2006-10-07 21:45:11 +02:00
ok ( minmax - > ptMaxSize . y = = rc . bottom , " default height of maximized child %d != %d \n " ,
2004-04-29 22:00:40 +02:00
minmax - > ptMaxSize . y , rc . bottom ) ;
}
2004-08-26 02:49:06 +02:00
if ( message = = WM_PAINT )
{
PAINTSTRUCT ps ;
beginpaint_counter + + ;
BeginPaint ( hwnd , & ps ) ;
beginpaint_counter - - ;
EndPaint ( hwnd , & ps ) ;
return 0 ;
}
2004-04-06 22:09:59 +02:00
defwndproc_counter + + ;
2005-10-18 12:45:18 +02:00
ret = unicode ? DefWindowProcW ( hwnd , message , wParam , lParam )
: DefWindowProcA ( hwnd , message , wParam , lParam ) ;
2004-04-06 22:09:59 +02:00
defwndproc_counter - - ;
return ret ;
2003-10-02 06:32:56 +02:00
}
2005-10-18 12:45:18 +02:00
static LRESULT WINAPI MsgCheckProcA ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
return MsgCheckProc ( FALSE , hwnd , message , wParam , lParam ) ;
}
static LRESULT WINAPI MsgCheckProcW ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
return MsgCheckProc ( TRUE , hwnd , message , wParam , lParam ) ;
}
2004-04-02 22:22:53 +02:00
static LRESULT WINAPI PopupMsgCheckProcA ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-04-22 10:25:30 +02:00
static LONG defwndproc_counter = 0 ;
2004-04-06 22:09:59 +02:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-04-02 22:22:53 +02:00
2009-05-12 12:09:30 +02:00
if ( ignore_message ( message ) ) return 0 ;
2008-07-31 17:16:22 +02:00
switch ( message )
{
case WM_QUERYENDSESSION :
case WM_ENDSESSION :
lParam & = ~ 0x01 ; /* Vista adds a 0x01 flag */
break ;
}
2005-09-28 20:11:10 +02:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2004-04-02 22:22:53 +02:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
2004-04-06 22:09:59 +02:00
if ( defwndproc_counter ) msg . flags | = defwinproc ;
2004-04-02 22:22:53 +02:00
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " popup " ;
2004-04-02 22:22:53 +02:00
add_message ( & msg ) ;
if ( message = = WM_CREATE )
{
DWORD style = GetWindowLongA ( hwnd , GWL_STYLE ) | WS_VISIBLE ;
SetWindowLongA ( hwnd , GWL_STYLE , style ) ;
}
2004-04-06 22:09:59 +02:00
defwndproc_counter + + ;
ret = DefWindowProcA ( hwnd , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
2004-04-02 22:22:53 +02:00
}
2004-03-26 03:28:28 +01:00
static LRESULT WINAPI ParentMsgCheckProcA ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-04-22 10:25:30 +02:00
static LONG defwndproc_counter = 0 ;
static LONG beginpaint_counter = 0 ;
2004-04-06 22:09:59 +02:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-03-26 03:28:28 +01:00
2009-05-12 12:09:30 +02:00
if ( ignore_message ( message ) ) return 0 ;
2008-09-15 11:29:58 +02:00
2004-12-07 18:34:19 +01:00
if ( log_all_parent_messages | |
message = = WM_PARENTNOTIFY | | message = = WM_CANCELMODE | |
2004-05-20 03:17:28 +02:00
message = = WM_SETFOCUS | | message = = WM_KILLFOCUS | |
message = = WM_ENABLE | | message = = WM_ENTERIDLE | |
2009-06-18 13:06:33 +02:00
message = = WM_DRAWITEM | | message = = WM_COMMAND | |
2004-05-20 03:17:28 +02:00
message = = WM_IME_SETCONTEXT )
2004-03-26 03:28:28 +01:00
{
2005-09-28 17:13:10 +02:00
switch ( message )
{
2007-01-07 12:40:46 +01:00
/* ignore */
case WM_NCHITTEST :
return HTCLIENT ;
case WM_SETCURSOR :
case WM_MOUSEMOVE :
2009-01-25 17:29:05 +01:00
case WM_NCMOUSEMOVE :
2006-10-28 10:24:13 +02:00
return 0 ;
2005-09-28 17:13:10 +02:00
case WM_ERASEBKGND :
{
RECT rc ;
INT ret = GetClipBox ( ( HDC ) wParam , & rc ) ;
2006-10-07 21:45:11 +02:00
trace ( " WM_ERASEBKGND: GetClipBox()=%d, (%d,%d-%d,%d) \n " ,
2005-09-28 17:13:10 +02:00
ret , rc . left , rc . top , rc . right , rc . bottom ) ;
break ;
}
}
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2004-03-26 03:28:28 +01:00
msg . message = message ;
msg . flags = sent | parent | wparam | lparam ;
2004-04-06 22:09:59 +02:00
if ( defwndproc_counter ) msg . flags | = defwinproc ;
2004-12-07 18:34:19 +01:00
if ( beginpaint_counter ) msg . flags | = beginpaint ;
2004-03-26 03:28:28 +01:00
msg . wParam = wParam ;
2009-01-12 21:03:57 +01:00
msg . lParam = lParam ;
msg . descr = " parent " ;
2004-03-26 03:28:28 +01:00
add_message ( & msg ) ;
}
2004-12-07 18:34:19 +01:00
if ( message = = WM_PAINT )
{
PAINTSTRUCT ps ;
beginpaint_counter + + ;
BeginPaint ( hwnd , & ps ) ;
beginpaint_counter - - ;
EndPaint ( hwnd , & ps ) ;
return 0 ;
}
2004-04-06 22:09:59 +02:00
defwndproc_counter + + ;
ret = DefWindowProcA ( hwnd , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
2004-03-26 03:28:28 +01:00
}
2004-04-20 06:02:50 +02:00
static LRESULT WINAPI TestDlgProcA ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-04-22 10:25:30 +02:00
static LONG defwndproc_counter = 0 ;
2004-04-20 06:02:50 +02:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-04-20 06:02:50 +02:00
2009-05-12 12:09:30 +02:00
if ( ignore_message ( message ) ) return 0 ;
2005-09-28 20:11:10 +02:00
2007-02-14 11:45:45 +01:00
if ( test_def_id )
{
DefDlgProcA ( hwnd , DM_SETDEFID , 1 , 0 ) ;
ret = DefDlgProcA ( hwnd , DM_GETDEFID , 0 , 0 ) ;
if ( after_end_dialog )
ok ( ret = = 0 , " DM_GETDEFID should return 0 after EndDialog, got %lx \n " , ret ) ;
else
ok ( HIWORD ( ret ) = = DC_HASDEFID , " DM_GETDEFID should return DC_HASDEFID, got %lx \n " , ret ) ;
}
2004-04-20 06:02:50 +02:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2004-04-20 06:02:50 +02:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
if ( defwndproc_counter ) msg . flags | = defwinproc ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " dialog " ;
2004-04-20 06:02:50 +02:00
add_message ( & msg ) ;
defwndproc_counter + + ;
ret = DefDlgProcA ( hwnd , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
}
2006-12-22 11:32:04 +01:00
static LRESULT WINAPI ShowWindowProcA ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-04-22 10:25:30 +02:00
static LONG defwndproc_counter = 0 ;
2006-12-22 11:32:04 +01:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2006-12-22 11:32:04 +01:00
/* log only specific messages we are interested in */
switch ( message )
{
#if 0 /* probably log these as well */
case WM_ACTIVATE :
case WM_SETFOCUS :
case WM_KILLFOCUS :
# endif
case WM_SHOWWINDOW :
case WM_SIZE :
case WM_MOVE :
case WM_GETMINMAXINFO :
case WM_WINDOWPOSCHANGING :
case WM_WINDOWPOSCHANGED :
break ;
default : /* ignore */
/*trace("showwindow: %p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam);*/
return DefWindowProcA ( hwnd , message , wParam , lParam ) ;
}
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2006-12-22 11:32:04 +01:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
if ( defwndproc_counter ) msg . flags | = defwinproc ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " show " ;
2006-12-22 11:32:04 +01:00
add_message ( & msg ) ;
defwndproc_counter + + ;
ret = DefWindowProcA ( hwnd , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
}
2008-12-12 10:22:24 +01:00
static LRESULT WINAPI PaintLoopProcA ( HWND hWnd , UINT msg , WPARAM wParam , LPARAM lParam )
2008-08-26 16:55:05 +02:00
{
switch ( msg )
{
case WM_CREATE : return 0 ;
case WM_PAINT :
{
MSG msg2 ;
static int i = 0 ;
2008-09-15 11:29:58 +02:00
if ( i < 256 )
2008-08-26 16:55:05 +02:00
{
2008-09-15 11:29:58 +02:00
i + + ;
if ( PeekMessageA ( & msg2 , 0 , 0 , 0 , 1 ) )
{
TranslateMessage ( & msg2 ) ;
DispatchMessage ( & msg2 ) ;
}
i - - ;
2008-08-26 16:55:05 +02:00
}
2008-09-15 11:29:58 +02:00
else ok ( broken ( 1 ) , " infinite loop \n " ) ;
2008-08-26 16:55:05 +02:00
if ( i = = 0 )
paint_loop_done = 1 ;
return DefWindowProcA ( hWnd , msg , wParam , lParam ) ;
}
}
return DefWindowProcA ( hWnd , msg , wParam , lParam ) ;
}
2003-10-02 06:32:56 +02:00
static BOOL RegisterWindowClasses ( void )
{
WNDCLASSA cls ;
2007-08-08 18:25:57 +02:00
WNDCLASSW clsW ;
2003-10-02 06:32:56 +02:00
cls . style = 0 ;
cls . lpfnWndProc = MsgCheckProcA ;
cls . cbClsExtra = 0 ;
cls . cbWndExtra = 0 ;
cls . hInstance = GetModuleHandleA ( 0 ) ;
cls . hIcon = 0 ;
2009-01-13 10:55:46 +01:00
cls . hCursor = LoadCursorA ( 0 , IDC_ARROW ) ;
2003-10-02 06:32:56 +02:00
cls . hbrBackground = GetStockObject ( WHITE_BRUSH ) ;
cls . lpszMenuName = NULL ;
cls . lpszClassName = " TestWindowClass " ;
2004-04-02 22:22:53 +02:00
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
2003-10-02 06:32:56 +02:00
2006-12-22 11:32:04 +01:00
cls . lpfnWndProc = ShowWindowProcA ;
cls . lpszClassName = " ShowWindowClass " ;
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
2004-04-02 22:22:53 +02:00
cls . lpfnWndProc = PopupMsgCheckProcA ;
cls . lpszClassName = " TestPopupClass " ;
2003-10-02 06:32:56 +02:00
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
2004-03-26 03:28:28 +01:00
cls . lpfnWndProc = ParentMsgCheckProcA ;
2003-10-02 06:32:56 +02:00
cls . lpszClassName = " TestParentClass " ;
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
cls . lpfnWndProc = DefWindowProcA ;
cls . lpszClassName = " SimpleWindowClass " ;
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
2008-08-26 16:55:05 +02:00
cls . lpfnWndProc = PaintLoopProcA ;
cls . lpszClassName = " PaintLoopWindowClass " ;
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
2005-03-30 20:59:27 +02:00
cls . style = CS_NOCLOSE ;
cls . lpszClassName = " NoCloseWindowClass " ;
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
2004-04-20 06:02:50 +02:00
ok ( GetClassInfoA ( 0 , " #32770 " , & cls ) , " GetClassInfo failed \n " ) ;
2005-01-06 21:43:34 +01:00
cls . style = 0 ;
cls . hInstance = GetModuleHandleA ( 0 ) ;
cls . hbrBackground = 0 ;
2004-04-20 06:02:50 +02:00
cls . lpfnWndProc = TestDlgProcA ;
cls . lpszClassName = " TestDialogClass " ;
if ( ! RegisterClassA ( & cls ) ) return FALSE ;
2007-08-08 18:25:57 +02:00
clsW . style = 0 ;
clsW . lpfnWndProc = MsgCheckProcW ;
clsW . cbClsExtra = 0 ;
clsW . cbWndExtra = 0 ;
clsW . hInstance = GetModuleHandleW ( 0 ) ;
clsW . hIcon = 0 ;
clsW . hCursor = LoadCursorW ( 0 , ( LPWSTR ) IDC_ARROW ) ;
clsW . hbrBackground = GetStockObject ( WHITE_BRUSH ) ;
clsW . lpszMenuName = NULL ;
clsW . lpszClassName = testWindowClassW ;
RegisterClassW ( & clsW ) ; /* ignore error, this fails on Win9x */
2003-10-02 06:32:56 +02:00
return TRUE ;
}
2008-06-18 05:34:01 +02:00
static BOOL is_our_logged_class ( HWND hwnd )
{
char buf [ 256 ] ;
if ( GetClassNameA ( hwnd , buf , sizeof ( buf ) ) )
{
if ( ! lstrcmpiA ( buf , " TestWindowClass " ) | |
! lstrcmpiA ( buf , " ShowWindowClass " ) | |
! lstrcmpiA ( buf , " TestParentClass " ) | |
! lstrcmpiA ( buf , " TestPopupClass " ) | |
! lstrcmpiA ( buf , " SimpleWindowClass " ) | |
! lstrcmpiA ( buf , " TestDialogClass " ) | |
! lstrcmpiA ( buf , " MDI_frame_class " ) | |
! lstrcmpiA ( buf , " MDI_client_class " ) | |
! lstrcmpiA ( buf , " MDI_child_class " ) | |
! lstrcmpiA ( buf , " my_button_class " ) | |
! lstrcmpiA ( buf , " my_edit_class " ) | |
! lstrcmpiA ( buf , " static " ) | |
! lstrcmpiA ( buf , " ListBox " ) | |
! lstrcmpiA ( buf , " ComboBox " ) | |
! lstrcmpiA ( buf , " MyDialogClass " ) | |
! lstrcmpiA ( buf , " #32770 " ) | |
! lstrcmpiA ( buf , " #32768 " ) )
return TRUE ;
}
return FALSE ;
}
2004-03-26 01:18:20 +01:00
static LRESULT CALLBACK cbt_hook_proc ( int nCode , WPARAM wParam , LPARAM lParam )
{
2005-02-23 13:44:06 +01:00
HWND hwnd ;
2004-03-26 01:18:20 +01:00
2005-01-27 12:14:19 +01:00
ok ( cbt_hook_thread_id = = GetCurrentThreadId ( ) , " we didn't ask for events from other threads \n " ) ;
2007-01-07 12:40:46 +01:00
if ( nCode = = HCBT_CLICKSKIPPED )
{
/* ignore this event, XP sends it a lot when switching focus between windows */
return CallNextHookEx ( hCBT_hook , nCode , wParam , lParam ) ;
}
2006-10-28 10:24:13 +02:00
if ( nCode = = HCBT_SYSCOMMAND | | nCode = = HCBT_KEYSKIPPED )
2004-09-13 21:32:59 +02:00
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-09-13 21:32:59 +02:00
2009-01-12 21:03:57 +01:00
msg . hwnd = 0 ;
2004-09-13 21:32:59 +02:00
msg . message = nCode ;
2005-01-27 12:14:19 +01:00
msg . flags = hook | wparam | lparam ;
2004-09-13 21:32:59 +02:00
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " CBT " ;
2004-09-13 21:32:59 +02:00
add_message ( & msg ) ;
return CallNextHookEx ( hCBT_hook , nCode , wParam , lParam ) ;
}
2005-02-18 21:01:41 +01:00
if ( nCode = = HCBT_DESTROYWND )
{
if ( test_DestroyWindow_flag )
{
DWORD style = GetWindowLongA ( ( HWND ) wParam , GWL_STYLE ) ;
if ( style & WS_CHILD )
2005-09-09 17:20:04 +02:00
lParam = GetWindowLongPtrA ( ( HWND ) wParam , GWLP_ID ) ;
2005-02-18 21:01:41 +01:00
else if ( style & WS_POPUP )
lParam = WND_POPUP_ID ;
else
lParam = WND_PARENT_ID ;
}
}
2004-08-10 01:38:40 +02:00
/* Log also SetFocus(0) calls */
2005-02-23 13:44:06 +01:00
hwnd = wParam ? ( HWND ) wParam : ( HWND ) lParam ;
2004-08-10 01:38:40 +02:00
2008-06-18 05:34:01 +02:00
if ( is_our_logged_class ( hwnd ) )
2004-03-26 01:18:20 +01:00
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2004-03-26 01:18:20 +01:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2008-06-18 05:34:01 +02:00
msg . message = nCode ;
msg . flags = hook | wparam | lparam ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " CBT " ;
2008-06-18 05:34:01 +02:00
add_message ( & msg ) ;
2004-03-26 01:18:20 +01:00
}
return CallNextHookEx ( hCBT_hook , nCode , wParam , lParam ) ;
}
2005-01-06 21:43:34 +01:00
static void CALLBACK win_event_proc ( HWINEVENTHOOK hevent ,
DWORD event ,
HWND hwnd ,
LONG object_id ,
LONG child_id ,
DWORD thread_id ,
DWORD event_time )
{
2005-01-27 12:14:19 +01:00
ok ( thread_id = = GetCurrentThreadId ( ) , " we didn't ask for events from other threads \n " ) ;
2005-01-06 21:43:34 +01:00
/* ignore mouse cursor events */
if ( object_id = = OBJID_CURSOR ) return ;
2008-06-18 05:34:01 +02:00
if ( ! hwnd | | is_our_logged_class ( hwnd ) )
2005-01-06 21:43:34 +01:00
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2005-01-06 21:43:34 +01:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2008-06-18 05:34:01 +02:00
msg . message = event ;
msg . flags = winevent_hook | wparam | lparam ;
msg . wParam = object_id ;
msg . lParam = child_id ;
2009-01-12 21:03:57 +01:00
msg . descr = " WEH " ;
2008-06-18 05:34:01 +02:00
add_message ( & msg ) ;
2005-01-06 21:43:34 +01:00
}
}
2004-10-04 21:10:37 +02:00
static const WCHAR wszUnicode [ ] = { ' U ' , ' n ' , ' i ' , ' c ' , ' o ' , ' d ' , ' e ' , 0 } ;
static const WCHAR wszAnsi [ ] = { ' U ' , 0 } ;
static LRESULT CALLBACK MsgConversionProcW ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam )
{
switch ( uMsg )
{
case CB_FINDSTRINGEXACT :
trace ( " String: %p \n " , ( LPCWSTR ) lParam ) ;
2004-10-04 22:39:00 +02:00
if ( ! lstrcmpW ( ( LPCWSTR ) lParam , wszUnicode ) )
2004-10-04 21:10:37 +02:00
return 1 ;
2004-10-04 22:39:00 +02:00
if ( ! lstrcmpW ( ( LPCWSTR ) lParam , wszAnsi ) )
2004-10-04 21:10:37 +02:00
return 0 ;
return - 1 ;
}
return DefWindowProcW ( hwnd , uMsg , wParam , lParam ) ;
}
2005-10-18 12:45:18 +02:00
static const struct message WmGetTextLengthAfromW [ ] = {
{ WM_GETTEXTLENGTH , sent } ,
2008-08-04 23:07:10 +02:00
{ WM_GETTEXT , sent | optional } ,
2005-10-18 12:45:18 +02:00
{ 0 }
} ;
static const WCHAR dummy_window_text [ ] = { ' d ' , ' u ' , ' m ' , ' m ' , ' y ' , ' ' , ' t ' , ' e ' , ' x ' , ' t ' , 0 } ;
/* dummy window proc for WM_GETTEXTLENGTH test */
static LRESULT CALLBACK get_text_len_proc ( HWND hwnd , UINT msg , WPARAM wp , LPARAM lp )
{
switch ( msg )
{
case WM_GETTEXTLENGTH :
return lstrlenW ( dummy_window_text ) + 37 ; /* some random length */
case WM_GETTEXT :
lstrcpynW ( ( LPWSTR ) lp , dummy_window_text , wp ) ;
return lstrlenW ( ( LPWSTR ) lp ) ;
default :
return DefWindowProcW ( hwnd , msg , wp , lp ) ;
}
}
2004-10-04 21:10:37 +02:00
static void test_message_conversion ( void )
{
static const WCHAR wszMsgConversionClass [ ] =
{ ' M ' , ' s ' , ' g ' , ' C ' , ' o ' , ' n ' , ' v ' , ' e ' , ' r ' , ' s ' , ' i ' , ' o ' , ' n ' , ' C ' , ' l ' , ' a ' , ' s ' , ' s ' , 0 } ;
WNDCLASSW cls ;
LRESULT lRes ;
HWND hwnd ;
2005-10-18 12:45:18 +02:00
WNDPROC wndproc , newproc ;
BOOL ret ;
2004-10-04 21:10:37 +02:00
cls . style = 0 ;
cls . lpfnWndProc = MsgConversionProcW ;
cls . cbClsExtra = 0 ;
cls . cbWndExtra = 0 ;
cls . hInstance = GetModuleHandleW ( NULL ) ;
cls . hIcon = NULL ;
cls . hCursor = LoadCursorW ( NULL , ( LPWSTR ) IDC_ARROW ) ;
cls . hbrBackground = ( HBRUSH ) ( COLOR_BTNFACE + 1 ) ;
cls . lpszMenuName = NULL ;
cls . lpszClassName = wszMsgConversionClass ;
/* this call will fail on Win9x, but that doesn't matter as this test is
* meaningless on those platforms */
if ( ! RegisterClassW ( & cls ) ) return ;
hwnd = CreateWindowExW ( 0 , wszMsgConversionClass , NULL , WS_OVERLAPPED ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = NULL , " Window creation failed \n " ) ;
/* {W, A} -> A */
wndproc = ( WNDPROC ) GetWindowLongPtrA ( hwnd , GWLP_WNDPROC ) ;
lRes = CallWindowProcA ( wndproc , hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
ok ( lRes = = 0 , " String should have been converted \n " ) ;
lRes = CallWindowProcW ( wndproc , hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
ok ( lRes = = 1 , " String shouldn't have been converted \n " ) ;
/* {W, A} -> W */
wndproc = ( WNDPROC ) GetWindowLongPtrW ( hwnd , GWLP_WNDPROC ) ;
lRes = CallWindowProcA ( wndproc , hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
ok ( lRes = = 1 , " String shouldn't have been converted \n " ) ;
lRes = CallWindowProcW ( wndproc , hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
ok ( lRes = = 1 , " String shouldn't have been converted \n " ) ;
/* Synchronous messages */
lRes = SendMessageA ( hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
ok ( lRes = = 0 , " String should have been converted \n " ) ;
lRes = SendMessageW ( hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
ok ( lRes = = 1 , " String shouldn't have been converted \n " ) ;
/* Asynchronous messages */
SetLastError ( 0 ) ;
lRes = PostMessageA ( hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
2005-03-14 11:05:50 +01:00
ok ( lRes = = 0 & & ( GetLastError ( ) = = ERROR_MESSAGE_SYNC_ONLY | | GetLastError ( ) = = ERROR_INVALID_PARAMETER ) ,
2006-10-07 21:45:11 +02:00
" PostMessage on sync only message returned %ld, last error %d \n " , lRes , GetLastError ( ) ) ;
2004-10-04 21:10:37 +02:00
SetLastError ( 0 ) ;
lRes = PostMessageW ( hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
2005-03-14 11:05:50 +01:00
ok ( lRes = = 0 & & ( GetLastError ( ) = = ERROR_MESSAGE_SYNC_ONLY | | GetLastError ( ) = = ERROR_INVALID_PARAMETER ) ,
2006-10-07 21:45:11 +02:00
" PostMessage on sync only message returned %ld, last error %d \n " , lRes , GetLastError ( ) ) ;
2004-10-04 22:39:00 +02:00
SetLastError ( 0 ) ;
lRes = PostThreadMessageA ( GetCurrentThreadId ( ) , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
2005-03-14 11:05:50 +01:00
ok ( lRes = = 0 & & ( GetLastError ( ) = = ERROR_MESSAGE_SYNC_ONLY | | GetLastError ( ) = = ERROR_INVALID_PARAMETER ) ,
2006-10-07 21:45:11 +02:00
" PosThreadtMessage on sync only message returned %ld, last error %d \n " , lRes , GetLastError ( ) ) ;
2004-10-04 22:39:00 +02:00
SetLastError ( 0 ) ;
lRes = PostThreadMessageW ( GetCurrentThreadId ( ) , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
2005-03-14 11:05:50 +01:00
ok ( lRes = = 0 & & ( GetLastError ( ) = = ERROR_MESSAGE_SYNC_ONLY | | GetLastError ( ) = = ERROR_INVALID_PARAMETER ) ,
2006-10-07 21:45:11 +02:00
" PosThreadtMessage on sync only message returned %ld, last error %d \n " , lRes , GetLastError ( ) ) ;
2004-10-04 22:39:00 +02:00
SetLastError ( 0 ) ;
lRes = SendNotifyMessageA ( hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
2005-03-14 11:05:50 +01:00
ok ( lRes = = 0 & & ( GetLastError ( ) = = ERROR_MESSAGE_SYNC_ONLY | | GetLastError ( ) = = ERROR_INVALID_PARAMETER ) ,
2006-10-07 21:45:11 +02:00
" SendNotifyMessage on sync only message returned %ld, last error %d \n " , lRes , GetLastError ( ) ) ;
2004-10-04 22:39:00 +02:00
SetLastError ( 0 ) ;
lRes = SendNotifyMessageW ( hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode ) ;
2005-03-14 11:05:50 +01:00
ok ( lRes = = 0 & & ( GetLastError ( ) = = ERROR_MESSAGE_SYNC_ONLY | | GetLastError ( ) = = ERROR_INVALID_PARAMETER ) ,
2006-10-07 21:45:11 +02:00
" SendNotifyMessage on sync only message returned %ld, last error %d \n " , lRes , GetLastError ( ) ) ;
2004-10-04 22:39:00 +02:00
SetLastError ( 0 ) ;
lRes = SendMessageCallbackA ( hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode , NULL , 0 ) ;
2005-03-14 11:05:50 +01:00
ok ( lRes = = 0 & & ( GetLastError ( ) = = ERROR_MESSAGE_SYNC_ONLY | | GetLastError ( ) = = ERROR_INVALID_PARAMETER ) ,
2006-10-07 21:45:11 +02:00
" SendMessageCallback on sync only message returned %ld, last error %d \n " , lRes , GetLastError ( ) ) ;
2004-10-04 22:39:00 +02:00
SetLastError ( 0 ) ;
lRes = SendMessageCallbackW ( hwnd , CB_FINDSTRINGEXACT , 0 , ( LPARAM ) wszUnicode , NULL , 0 ) ;
2005-03-14 11:05:50 +01:00
ok ( lRes = = 0 & & ( GetLastError ( ) = = ERROR_MESSAGE_SYNC_ONLY | | GetLastError ( ) = = ERROR_INVALID_PARAMETER ) ,
2006-10-07 21:45:11 +02:00
" SendMessageCallback on sync only message returned %ld, last error %d \n " , lRes , GetLastError ( ) ) ;
2005-10-18 12:45:18 +02:00
/* Check WM_GETTEXTLENGTH A->W behaviour, whether WM_GETTEXT is also sent or not */
hwnd = CreateWindowW ( testWindowClassW , wszUnicode ,
WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
assert ( hwnd ) ;
flush_sequence ( ) ;
lRes = SendMessageA ( hwnd , WM_GETTEXTLENGTH , 0 , 0 ) ;
ok_sequence ( WmGetTextLengthAfromW , " ANSI WM_GETTEXTLENGTH to Unicode window " , FALSE ) ;
ok ( lRes = = WideCharToMultiByte ( CP_ACP , 0 , wszUnicode , lstrlenW ( wszUnicode ) , NULL , 0 , NULL , NULL ) ,
" got bad length %ld \n " , lRes ) ;
flush_sequence ( ) ;
lRes = CallWindowProcA ( ( WNDPROC ) GetWindowLongPtrA ( hwnd , GWLP_WNDPROC ) ,
hwnd , WM_GETTEXTLENGTH , 0 , 0 ) ;
ok_sequence ( WmGetTextLengthAfromW , " ANSI WM_GETTEXTLENGTH to Unicode window " , FALSE ) ;
ok ( lRes = = WideCharToMultiByte ( CP_ACP , 0 , wszUnicode , lstrlenW ( wszUnicode ) , NULL , 0 , NULL , NULL ) ,
" got bad length %ld \n " , lRes ) ;
wndproc = ( WNDPROC ) SetWindowLongPtrW ( hwnd , GWLP_WNDPROC , ( LONG_PTR ) get_text_len_proc ) ;
newproc = ( WNDPROC ) GetWindowLongPtrA ( hwnd , GWLP_WNDPROC ) ;
lRes = CallWindowProcA ( newproc , hwnd , WM_GETTEXTLENGTH , 0 , 0 ) ;
ok ( lRes = = WideCharToMultiByte ( CP_ACP , 0 , dummy_window_text , lstrlenW ( dummy_window_text ) ,
2008-08-04 23:07:10 +02:00
NULL , 0 , NULL , NULL ) | |
broken ( lRes = = lstrlenW ( dummy_window_text ) + 37 ) ,
2005-10-18 12:45:18 +02:00
" got bad length %ld \n " , lRes ) ;
SetWindowLongPtrW ( hwnd , GWLP_WNDPROC , ( LONG_PTR ) wndproc ) ; /* restore old wnd proc */
lRes = CallWindowProcA ( newproc , hwnd , WM_GETTEXTLENGTH , 0 , 0 ) ;
ok ( lRes = = WideCharToMultiByte ( CP_ACP , 0 , dummy_window_text , lstrlenW ( dummy_window_text ) ,
2008-08-04 23:07:10 +02:00
NULL , 0 , NULL , NULL ) | |
broken ( lRes = = lstrlenW ( dummy_window_text ) + 37 ) ,
2005-10-18 12:45:18 +02:00
" got bad length %ld \n " , lRes ) ;
ret = DestroyWindow ( hwnd ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " DestroyWindow() error %d \n " , GetLastError ( ) ) ;
2004-10-04 21:10:37 +02:00
}
2006-02-23 17:57:59 +01:00
struct timer_info
2004-11-29 19:21:14 +01:00
{
HWND hWnd ;
HANDLE handles [ 2 ] ;
DWORD id ;
2006-02-23 17:57:59 +01:00
} ;
2004-11-29 19:21:14 +01:00
2007-05-24 16:41:17 +02:00
static VOID CALLBACK tfunc ( HWND hwnd , UINT uMsg , UINT_PTR id , DWORD dwTime )
2004-11-29 19:21:14 +01:00
{
}
2009-09-30 01:39:25 +02:00
static VOID CALLBACK tfunc_crash ( HWND hwnd , UINT uMsg , UINT_PTR id , DWORD dwTime )
{
/* Crash on purpose */
* ( volatile int * ) 0 = 2 ;
}
2004-11-29 19:21:14 +01:00
# define TIMER_ID 0x19
static DWORD WINAPI timer_thread_proc ( LPVOID x )
{
2006-02-23 17:57:59 +01:00
struct timer_info * info = x ;
2004-11-29 19:21:14 +01:00
DWORD r ;
r = KillTimer ( info - > hWnd , 0x19 ) ;
ok ( r , " KillTimer failed in thread \n " ) ;
r = SetTimer ( info - > hWnd , TIMER_ID , 10000 , tfunc ) ;
ok ( r , " SetTimer failed in thread \n " ) ;
ok ( r = = TIMER_ID , " SetTimer id different \n " ) ;
r = SetEvent ( info - > handles [ 0 ] ) ;
ok ( r , " SetEvent failed in thread \n " ) ;
return 0 ;
}
static void test_timers ( void )
{
2006-02-23 17:57:59 +01:00
struct timer_info info ;
2004-11-29 19:21:14 +01:00
DWORD id ;
2009-09-30 01:39:25 +02:00
MSG msg ;
2004-11-29 19:21:14 +01:00
info . hWnd = CreateWindow ( " TestWindowClass " , NULL ,
WS_OVERLAPPEDWINDOW ,
CW_USEDEFAULT , CW_USEDEFAULT , 300 , 300 , 0 ,
NULL , NULL , 0 ) ;
info . id = SetTimer ( info . hWnd , TIMER_ID , 10000 , tfunc ) ;
2004-12-14 12:41:24 +01:00
ok ( info . id , " SetTimer failed \n " ) ;
ok ( info . id = = TIMER_ID , " SetTimer timer ID different \n " ) ;
2004-11-29 19:21:14 +01:00
info . handles [ 0 ] = CreateEvent ( NULL , 0 , 0 , NULL ) ;
info . handles [ 1 ] = CreateThread ( NULL , 0 , timer_thread_proc , & info , 0 , & id ) ;
WaitForMultipleObjects ( 2 , info . handles , FALSE , INFINITE ) ;
WaitForSingleObject ( info . handles [ 1 ] , INFINITE ) ;
2005-01-27 12:14:19 +01:00
CloseHandle ( info . handles [ 0 ] ) ;
CloseHandle ( info . handles [ 1 ] ) ;
2004-11-29 19:21:14 +01:00
ok ( KillTimer ( info . hWnd , TIMER_ID ) , " KillTimer failed \n " ) ;
2009-09-30 21:00:33 +02:00
ok ( DestroyWindow ( info . hWnd ) , " failed to destroy window \n " ) ;
2009-09-30 01:39:25 +02:00
/* Test timer callback with crash */
2009-09-30 21:00:33 +02:00
SetLastError ( 0xdeadbeef ) ;
info . hWnd = CreateWindowW ( testWindowClassW , NULL ,
WS_OVERLAPPEDWINDOW ,
CW_USEDEFAULT , CW_USEDEFAULT , 300 , 300 , 0 ,
NULL , NULL , 0 ) ;
if ( ( ! info . hWnd & & GetLastError ( ) = = ERROR_CALL_NOT_IMPLEMENTED ) | | /* Win9x/Me */
( ! pGetMenuInfo ) ) /* Win95/NT4 */
{
win_skip ( " Test would crash on Win9x/WinMe/NT4 \n " ) ;
DestroyWindow ( info . hWnd ) ;
return ;
}
2009-09-30 01:39:25 +02:00
info . id = SetTimer ( info . hWnd , TIMER_ID , 0 , tfunc_crash ) ;
ok ( info . id , " SetTimer failed \n " ) ;
Sleep ( 150 ) ;
while ( PeekMessage ( & msg , NULL , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
2004-11-29 19:21:14 +01:00
ok ( DestroyWindow ( info . hWnd ) , " failed to destroy window \n " ) ;
}
2007-08-30 11:05:50 +02:00
static int count = 0 ;
static VOID CALLBACK callback_count (
HWND hwnd ,
UINT uMsg ,
UINT_PTR idEvent ,
DWORD dwTime
)
{
count + + ;
}
static void test_timers_no_wnd ( void )
{
UINT_PTR id , id2 ;
MSG msg ;
count = 0 ;
id = SetTimer ( NULL , 0 , 100 , callback_count ) ;
ok ( id ! = 0 , " did not get id from SetTimer. \n " ) ;
id2 = SetTimer ( NULL , id , 200 , callback_count ) ;
ok ( id2 = = id , " did not get same id from SetTimer when replacing (%li expected %li). \n " , id2 , id ) ;
Sleep ( 150 ) ;
while ( PeekMessage ( & msg , NULL , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok ( count = = 0 , " did not get zero count as expected (%i). \n " , count ) ;
Sleep ( 150 ) ;
while ( PeekMessage ( & msg , NULL , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok ( count = = 1 , " did not get one count as expected (%i). \n " , count ) ;
KillTimer ( NULL , id ) ;
Sleep ( 250 ) ;
while ( PeekMessage ( & msg , NULL , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok ( count = = 1 , " killing replaced timer did not work (%i). \n " , count ) ;
}
2005-01-06 21:43:34 +01:00
/* Various win events with arbitrary parameters */
static const struct message WmWinEventsSeq [ ] = {
{ EVENT_SYSTEM_SOUND , winevent_hook | wparam | lparam , OBJID_WINDOW , 0 } ,
{ EVENT_SYSTEM_ALERT , winevent_hook | wparam | lparam , OBJID_SYSMENU , 1 } ,
{ EVENT_SYSTEM_FOREGROUND , winevent_hook | wparam | lparam , OBJID_TITLEBAR , 2 } ,
{ EVENT_SYSTEM_MENUSTART , winevent_hook | wparam | lparam , OBJID_MENU , 3 } ,
{ EVENT_SYSTEM_MENUEND , winevent_hook | wparam | lparam , OBJID_CLIENT , 4 } ,
{ EVENT_SYSTEM_MENUPOPUPSTART , winevent_hook | wparam | lparam , OBJID_VSCROLL , 5 } ,
{ EVENT_SYSTEM_MENUPOPUPEND , winevent_hook | wparam | lparam , OBJID_HSCROLL , 6 } ,
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , OBJID_SIZEGRIP , 7 } ,
{ EVENT_SYSTEM_CAPTUREEND , winevent_hook | wparam | lparam , OBJID_CARET , 8 } ,
/* our win event hook ignores OBJID_CURSOR events */
/*{ EVENT_SYSTEM_MOVESIZESTART, winevent_hook|wparam|lparam, OBJID_CURSOR, 9 },*/
{ EVENT_SYSTEM_MOVESIZEEND , winevent_hook | wparam | lparam , OBJID_ALERT , 10 } ,
{ EVENT_SYSTEM_CONTEXTHELPSTART , winevent_hook | wparam | lparam , OBJID_SOUND , 11 } ,
{ EVENT_SYSTEM_CONTEXTHELPEND , winevent_hook | wparam | lparam , OBJID_QUERYCLASSNAMEIDX , 12 } ,
{ EVENT_SYSTEM_DRAGDROPSTART , winevent_hook | wparam | lparam , OBJID_NATIVEOM , 13 } ,
{ EVENT_SYSTEM_DRAGDROPEND , winevent_hook | wparam | lparam , OBJID_WINDOW , 0 } ,
{ EVENT_SYSTEM_DIALOGSTART , winevent_hook | wparam | lparam , OBJID_SYSMENU , 1 } ,
{ EVENT_SYSTEM_DIALOGEND , winevent_hook | wparam | lparam , OBJID_TITLEBAR , 2 } ,
{ EVENT_SYSTEM_SCROLLINGSTART , winevent_hook | wparam | lparam , OBJID_MENU , 3 } ,
{ EVENT_SYSTEM_SCROLLINGEND , winevent_hook | wparam | lparam , OBJID_CLIENT , 4 } ,
{ EVENT_SYSTEM_SWITCHSTART , winevent_hook | wparam | lparam , OBJID_VSCROLL , 5 } ,
{ EVENT_SYSTEM_SWITCHEND , winevent_hook | wparam | lparam , OBJID_HSCROLL , 6 } ,
{ EVENT_SYSTEM_MINIMIZESTART , winevent_hook | wparam | lparam , OBJID_SIZEGRIP , 7 } ,
{ EVENT_SYSTEM_MINIMIZEEND , winevent_hook | wparam | lparam , OBJID_CARET , 8 } ,
{ 0 }
} ;
2005-01-27 12:14:19 +01:00
static const struct message WmWinEventCaretSeq [ ] = {
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } , /* hook 1 */
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } , /* hook 1 */
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } , /* hook 2 */
{ EVENT_OBJECT_NAMECHANGE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } , /* hook 1 */
{ 0 }
} ;
static const struct message WmWinEventCaretSeq_2 [ ] = {
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } , /* hook 1/2 */
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } , /* hook 1/2 */
{ EVENT_OBJECT_NAMECHANGE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } , /* hook 1/2 */
{ 0 }
} ;
static const struct message WmWinEventAlertSeq [ ] = {
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , OBJID_ALERT , 0 } ,
{ 0 }
} ;
static const struct message WmWinEventAlertSeq_2 [ ] = {
/* create window in the thread proc */
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , OBJID_WINDOW , 2 } ,
/* our test event */
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , OBJID_ALERT , 2 } ,
{ 0 }
} ;
static const struct message WmGlobalHookSeq_1 [ ] = {
/* create window in the thread proc */
{ HCBT_CREATEWND , hook | lparam , 0 , 2 } ,
/* our test events */
2005-02-23 13:44:06 +01:00
{ HCBT_SYSCOMMAND , hook | wparam | lparam , SC_PREVWINDOW , 2 } ,
{ HCBT_SYSCOMMAND , hook | wparam | lparam , SC_NEXTWINDOW , 2 } ,
2005-01-27 12:14:19 +01:00
{ 0 }
} ;
static const struct message WmGlobalHookSeq_2 [ ] = {
{ HCBT_SYSCOMMAND , hook | wparam | lparam , SC_NEXTWINDOW , 0 } , /* old local hook */
{ HCBT_SYSCOMMAND , hook | wparam | lparam , SC_NEXTWINDOW , 2 } , /* new global hook */
{ HCBT_SYSCOMMAND , hook | wparam | lparam , SC_PREVWINDOW , 0 } , /* old local hook */
{ HCBT_SYSCOMMAND , hook | wparam | lparam , SC_PREVWINDOW , 2 } , /* new global hook */
{ 0 }
} ;
2005-01-06 21:43:34 +01:00
2006-01-30 14:56:17 +01:00
static const struct message WmMouseLLHookSeq [ ] = {
{ WM_MOUSEMOVE , hook } ,
{ WM_LBUTTONUP , hook } ,
2006-05-23 11:58:00 +02:00
{ WM_MOUSEMOVE , hook } ,
2006-01-30 14:56:17 +01:00
{ 0 }
} ;
2005-01-27 12:14:19 +01:00
static void CALLBACK win_event_global_hook_proc ( HWINEVENTHOOK hevent ,
DWORD event ,
HWND hwnd ,
LONG object_id ,
LONG child_id ,
DWORD thread_id ,
DWORD event_time )
{
char buf [ 256 ] ;
if ( GetClassNameA ( hwnd , buf , sizeof ( buf ) ) )
{
if ( ! lstrcmpiA ( buf , " TestWindowClass " ) | |
! lstrcmpiA ( buf , " static " ) )
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2005-01-27 12:14:19 +01:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2005-01-27 12:14:19 +01:00
msg . message = event ;
msg . flags = winevent_hook | wparam | lparam ;
msg . wParam = object_id ;
msg . lParam = ( thread_id = = GetCurrentThreadId ( ) ) ? child_id : ( child_id + 2 ) ;
2009-01-12 21:03:57 +01:00
msg . descr = " WEH_2 " ;
2005-01-27 12:14:19 +01:00
add_message ( & msg ) ;
}
}
}
static HHOOK hCBT_global_hook ;
static DWORD cbt_global_hook_thread_id ;
static LRESULT CALLBACK cbt_global_hook_proc ( int nCode , WPARAM wParam , LPARAM lParam )
{
2005-02-23 13:44:06 +01:00
HWND hwnd ;
2005-01-27 12:14:19 +01:00
char buf [ 256 ] ;
if ( nCode = = HCBT_SYSCOMMAND )
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2005-01-27 12:14:19 +01:00
2009-01-12 21:03:57 +01:00
msg . hwnd = 0 ;
2005-01-27 12:14:19 +01:00
msg . message = nCode ;
msg . flags = hook | wparam | lparam ;
msg . wParam = wParam ;
msg . lParam = ( cbt_global_hook_thread_id = = GetCurrentThreadId ( ) ) ? 1 : 2 ;
2009-01-12 21:03:57 +01:00
msg . descr = " CBT_2 " ;
2005-01-27 12:14:19 +01:00
add_message ( & msg ) ;
return CallNextHookEx ( hCBT_global_hook , nCode , wParam , lParam ) ;
}
2006-01-30 14:56:17 +01:00
/* WH_MOUSE_LL hook */
if ( nCode = = HC_ACTION )
{
MSLLHOOKSTRUCT * mhll = ( MSLLHOOKSTRUCT * ) lParam ;
/* we can't test for real mouse events */
if ( mhll - > flags & LLMHF_INJECTED )
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2008-03-24 13:06:48 +01:00
memset ( & msg , 0 , sizeof ( msg ) ) ;
2006-01-30 14:56:17 +01:00
msg . message = wParam ;
2008-03-24 13:06:48 +01:00
msg . flags = hook ;
2009-01-12 21:03:57 +01:00
msg . descr = " CBT_2 " ;
2006-01-30 14:56:17 +01:00
add_message ( & msg ) ;
}
return CallNextHookEx ( hCBT_global_hook , nCode , wParam , lParam ) ;
}
2005-01-27 12:14:19 +01:00
/* Log also SetFocus(0) calls */
2005-02-23 13:44:06 +01:00
hwnd = wParam ? ( HWND ) wParam : ( HWND ) lParam ;
2005-01-27 12:14:19 +01:00
2005-02-23 13:44:06 +01:00
if ( GetClassNameA ( hwnd , buf , sizeof ( buf ) ) )
2005-01-27 12:14:19 +01:00
{
if ( ! lstrcmpiA ( buf , " TestWindowClass " ) | |
! lstrcmpiA ( buf , " static " ) )
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2005-01-27 12:14:19 +01:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2005-01-27 12:14:19 +01:00
msg . message = nCode ;
msg . flags = hook | wparam | lparam ;
msg . wParam = wParam ;
msg . lParam = ( cbt_global_hook_thread_id = = GetCurrentThreadId ( ) ) ? 1 : 2 ;
2009-01-12 21:03:57 +01:00
msg . descr = " CBT_2 " ;
2005-01-27 12:14:19 +01:00
add_message ( & msg ) ;
}
}
return CallNextHookEx ( hCBT_global_hook , nCode , wParam , lParam ) ;
}
static DWORD WINAPI win_event_global_thread_proc ( void * param )
2005-01-06 21:43:34 +01:00
{
HWND hwnd ;
2005-01-27 12:14:19 +01:00
MSG msg ;
HANDLE hevent = * ( HANDLE * ) param ;
assert ( pNotifyWinEvent ) ;
hwnd = CreateWindowExA ( 0 , " static " , NULL , WS_POPUP , 0 , 0 , 0 , 0 , 0 , 0 , 0 , NULL ) ;
assert ( hwnd ) ;
trace ( " created thread window %p \n " , hwnd ) ;
* ( HWND * ) param = hwnd ;
flush_sequence ( ) ;
/* this event should be received only by our new hook proc,
* an old one does not expect an event from another thread .
*/
pNotifyWinEvent ( EVENT_OBJECT_LOCATIONCHANGE , hwnd , OBJID_ALERT , 0 ) ;
SetEvent ( hevent ) ;
while ( GetMessage ( & msg , 0 , 0 , 0 ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
return 0 ;
}
static DWORD WINAPI cbt_global_hook_thread_proc ( void * param )
{
HWND hwnd ;
MSG msg ;
HANDLE hevent = * ( HANDLE * ) param ;
flush_sequence ( ) ;
/* these events should be received only by our new hook proc,
* an old one does not expect an event from another thread .
*/
hwnd = CreateWindowExA ( 0 , " static " , NULL , WS_POPUP , 0 , 0 , 0 , 0 , 0 , 0 , 0 , NULL ) ;
assert ( hwnd ) ;
trace ( " created thread window %p \n " , hwnd ) ;
* ( HWND * ) param = hwnd ;
2005-02-23 13:44:06 +01:00
/* Windows doesn't like when a thread plays games with the focus,
that leads to all kinds of misbehaviours and failures to activate
a window . So , better keep next lines commented out .
2005-01-27 12:14:19 +01:00
SetFocus ( 0 ) ;
2005-02-23 13:44:06 +01:00
SetFocus ( hwnd ) ; */
DefWindowProcA ( hwnd , WM_SYSCOMMAND , SC_PREVWINDOW , 0 ) ;
DefWindowProcA ( hwnd , WM_SYSCOMMAND , SC_NEXTWINDOW , 0 ) ;
2005-01-27 12:14:19 +01:00
SetEvent ( hevent ) ;
while ( GetMessage ( & msg , 0 , 0 , 0 ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
return 0 ;
}
2006-01-30 14:56:17 +01:00
static DWORD WINAPI mouse_ll_global_thread_proc ( void * param )
{
HWND hwnd ;
MSG msg ;
HANDLE hevent = * ( HANDLE * ) param ;
hwnd = CreateWindowExA ( 0 , " static " , NULL , WS_POPUP , 0 , 0 , 0 , 0 , 0 , 0 , 0 , NULL ) ;
assert ( hwnd ) ;
trace ( " created thread window %p \n " , hwnd ) ;
* ( HWND * ) param = hwnd ;
flush_sequence ( ) ;
2006-05-23 11:58:00 +02:00
/* Windows doesn't like when a thread plays games with the focus,
* that leads to all kinds of misbehaviours and failures to activate
* a window . So , better don ' t generate a mouse click message below .
*/
mouse_event ( MOUSEEVENTF_MOVE , - 1 , 0 , 0 , 0 ) ;
2006-01-30 14:56:17 +01:00
mouse_event ( MOUSEEVENTF_LEFTUP , 0 , 0 , 0 , 0 ) ;
2006-05-23 11:58:00 +02:00
mouse_event ( MOUSEEVENTF_MOVE , 1 , 0 , 0 , 0 ) ;
2006-01-30 14:56:17 +01:00
SetEvent ( hevent ) ;
while ( GetMessage ( & msg , 0 , 0 , 0 ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
return 0 ;
}
2005-01-27 12:14:19 +01:00
static void test_winevents ( void )
{
2005-03-31 21:07:08 +02:00
BOOL ret ;
2005-01-27 12:14:19 +01:00
MSG msg ;
HWND hwnd , hwnd2 ;
2005-01-06 21:43:34 +01:00
UINT i ;
2005-01-27 12:14:19 +01:00
HANDLE hthread , hevent ;
DWORD tid ;
HWINEVENTHOOK hhook ;
2005-01-06 21:43:34 +01:00
const struct message * events = WmWinEventsSeq ;
2005-01-27 12:14:19 +01:00
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , NULL ,
WS_OVERLAPPEDWINDOW ,
CW_USEDEFAULT , CW_USEDEFAULT , 300 , 300 , 0 ,
NULL , NULL , 0 ) ;
2005-01-06 21:43:34 +01:00
assert ( hwnd ) ;
2005-01-27 12:14:19 +01:00
/****** start of global hook test *************/
hCBT_global_hook = SetWindowsHookExA ( WH_CBT , cbt_global_hook_proc , GetModuleHandleA ( 0 ) , 0 ) ;
2008-03-03 17:51:42 +01:00
if ( ! hCBT_global_hook )
{
ok ( DestroyWindow ( hwnd ) , " failed to destroy window \n " ) ;
skip ( " cannot set global hook \n " ) ;
return ;
}
2005-01-27 12:14:19 +01:00
hevent = CreateEventA ( NULL , 0 , 0 , NULL ) ;
assert ( hevent ) ;
2009-02-05 09:53:39 +01:00
hwnd2 = hevent ;
2005-01-27 12:14:19 +01:00
hthread = CreateThread ( NULL , 0 , cbt_global_hook_thread_proc , & hwnd2 , 0 , & tid ) ;
2006-10-07 21:45:11 +02:00
ok ( hthread ! = NULL , " CreateThread failed, error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
ok ( WaitForSingleObject ( hevent , INFINITE ) = = WAIT_OBJECT_0 , " WaitForSingleObject failed \n " ) ;
ok_sequence ( WmGlobalHookSeq_1 , " global hook 1 " , FALSE ) ;
flush_sequence ( ) ;
/* this one should be received only by old hook proc */
DefWindowProcA ( hwnd , WM_SYSCOMMAND , SC_NEXTWINDOW , 0 ) ;
/* this one should be received only by old hook proc */
DefWindowProcA ( hwnd , WM_SYSCOMMAND , SC_PREVWINDOW , 0 ) ;
ok_sequence ( WmGlobalHookSeq_2 , " global hook 2 " , FALSE ) ;
2005-03-31 21:07:08 +02:00
ret = UnhookWindowsHookEx ( hCBT_global_hook ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " UnhookWindowsHookEx error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
PostThreadMessageA ( tid , WM_QUIT , 0 , 0 ) ;
ok ( WaitForSingleObject ( hthread , INFINITE ) = = WAIT_OBJECT_0 , " WaitForSingleObject failed \n " ) ;
CloseHandle ( hthread ) ;
CloseHandle ( hevent ) ;
ok ( ! IsWindow ( hwnd2 ) , " window should be destroyed on thread exit \n " ) ;
/****** end of global hook test *************/
if ( ! pSetWinEventHook | | ! pNotifyWinEvent | | ! pUnhookWinEvent )
{
ok ( DestroyWindow ( hwnd ) , " failed to destroy window \n " ) ;
return ;
}
2005-01-06 21:43:34 +01:00
flush_sequence ( ) ;
2006-12-14 18:10:47 +01:00
if ( 0 )
{
/* this test doesn't pass under Win9x */
2005-01-27 12:14:19 +01:00
/* win2k ignores events with hwnd == 0 */
2005-01-11 11:38:31 +01:00
SetLastError ( 0xdeadbeef ) ;
2005-01-06 21:43:34 +01:00
pNotifyWinEvent ( events [ 0 ] . message , 0 , events [ 0 ] . wParam , events [ 0 ] . lParam ) ;
2005-01-11 11:38:31 +01:00
ok ( GetLastError ( ) = = ERROR_INVALID_WINDOW_HANDLE | | /* Win2k */
GetLastError ( ) = = 0xdeadbeef , /* Win9x */
2006-12-14 18:10:47 +01:00
" unexpected error %d \n " , GetLastError ( ) ) ;
2005-01-06 21:43:34 +01:00
ok_sequence ( WmEmptySeq , " empty notify winevents " , FALSE ) ;
2006-12-14 18:10:47 +01:00
}
2005-01-06 21:43:34 +01:00
for ( i = 0 ; i < sizeof ( WmWinEventsSeq ) / sizeof ( WmWinEventsSeq [ 0 ] ) ; i + + )
pNotifyWinEvent ( events [ i ] . message , hwnd , events [ i ] . wParam , events [ i ] . lParam ) ;
ok_sequence ( WmWinEventsSeq , " notify winevents " , FALSE ) ;
2005-01-27 12:14:19 +01:00
/****** start of event filtering test *************/
2009-02-05 09:53:39 +01:00
hhook = pSetWinEventHook (
2005-01-27 12:14:19 +01:00
EVENT_OBJECT_SHOW , /* 0x8002 */
EVENT_OBJECT_LOCATIONCHANGE , /* 0x800B */
GetModuleHandleA ( 0 ) , win_event_global_hook_proc ,
GetCurrentProcessId ( ) , 0 ,
WINEVENT_INCONTEXT ) ;
2006-10-07 21:45:11 +02:00
ok ( hhook ! = 0 , " SetWinEventHook error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
hevent = CreateEventA ( NULL , 0 , 0 , NULL ) ;
assert ( hevent ) ;
2009-02-05 09:53:39 +01:00
hwnd2 = hevent ;
2005-01-27 12:14:19 +01:00
hthread = CreateThread ( NULL , 0 , win_event_global_thread_proc , & hwnd2 , 0 , & tid ) ;
2006-10-07 21:45:11 +02:00
ok ( hthread ! = NULL , " CreateThread failed, error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
ok ( WaitForSingleObject ( hevent , INFINITE ) = = WAIT_OBJECT_0 , " WaitForSingleObject failed \n " ) ;
ok_sequence ( WmWinEventAlertSeq , " alert winevent " , FALSE ) ;
flush_sequence ( ) ;
/* this one should be received only by old hook proc */
pNotifyWinEvent ( EVENT_OBJECT_CREATE , hwnd , OBJID_CARET , 0 ) ; /* 0x8000 */
pNotifyWinEvent ( EVENT_OBJECT_SHOW , hwnd , OBJID_CARET , 0 ) ; /* 0x8002 */
/* this one should be received only by old hook proc */
pNotifyWinEvent ( EVENT_OBJECT_NAMECHANGE , hwnd , OBJID_CARET , 0 ) ; /* 0x800C */
ok_sequence ( WmWinEventCaretSeq , " caret winevent " , FALSE ) ;
2005-03-31 21:07:08 +02:00
ret = pUnhookWinEvent ( hhook ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " UnhookWinEvent error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
PostThreadMessageA ( tid , WM_QUIT , 0 , 0 ) ;
ok ( WaitForSingleObject ( hthread , INFINITE ) = = WAIT_OBJECT_0 , " WaitForSingleObject failed \n " ) ;
CloseHandle ( hthread ) ;
CloseHandle ( hevent ) ;
ok ( ! IsWindow ( hwnd2 ) , " window should be destroyed on thread exit \n " ) ;
/****** end of event filtering test *************/
/****** start of out of context event test *************/
2009-02-05 09:53:39 +01:00
hhook = pSetWinEventHook ( EVENT_MIN , EVENT_MAX , 0 ,
win_event_global_hook_proc , GetCurrentProcessId ( ) , 0 ,
2005-01-27 12:14:19 +01:00
WINEVENT_OUTOFCONTEXT ) ;
2006-10-07 21:45:11 +02:00
ok ( hhook ! = 0 , " SetWinEventHook error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
hevent = CreateEventA ( NULL , 0 , 0 , NULL ) ;
assert ( hevent ) ;
2009-02-05 09:53:39 +01:00
hwnd2 = hevent ;
2005-01-27 12:14:19 +01:00
flush_sequence ( ) ;
hthread = CreateThread ( NULL , 0 , win_event_global_thread_proc , & hwnd2 , 0 , & tid ) ;
2006-10-07 21:45:11 +02:00
ok ( hthread ! = NULL , " CreateThread failed, error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
ok ( WaitForSingleObject ( hevent , INFINITE ) = = WAIT_OBJECT_0 , " WaitForSingleObject failed \n " ) ;
ok_sequence ( WmEmptySeq , " empty notify winevents " , FALSE ) ;
/* process pending winevent messages */
ok ( ! PeekMessageA ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) , " msg queue should be empty \n " ) ;
ok_sequence ( WmWinEventAlertSeq_2 , " alert winevent for out of context proc " , FALSE ) ;
flush_sequence ( ) ;
/* this one should be received only by old hook proc */
pNotifyWinEvent ( EVENT_OBJECT_CREATE , hwnd , OBJID_CARET , 0 ) ; /* 0x8000 */
pNotifyWinEvent ( EVENT_OBJECT_SHOW , hwnd , OBJID_CARET , 0 ) ; /* 0x8002 */
/* this one should be received only by old hook proc */
pNotifyWinEvent ( EVENT_OBJECT_NAMECHANGE , hwnd , OBJID_CARET , 0 ) ; /* 0x800C */
ok_sequence ( WmWinEventCaretSeq_2 , " caret winevent for incontext proc " , FALSE ) ;
/* process pending winevent messages */
ok ( ! PeekMessageA ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) , " msg queue should be empty \n " ) ;
ok_sequence ( WmWinEventCaretSeq_2 , " caret winevent for out of context proc " , FALSE ) ;
2005-03-31 21:07:08 +02:00
ret = pUnhookWinEvent ( hhook ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " UnhookWinEvent error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
PostThreadMessageA ( tid , WM_QUIT , 0 , 0 ) ;
ok ( WaitForSingleObject ( hthread , INFINITE ) = = WAIT_OBJECT_0 , " WaitForSingleObject failed \n " ) ;
CloseHandle ( hthread ) ;
CloseHandle ( hevent ) ;
ok ( ! IsWindow ( hwnd2 ) , " window should be destroyed on thread exit \n " ) ;
/****** end of out of context event test *************/
2006-01-30 14:56:17 +01:00
/****** start of MOUSE_LL hook test *************/
hCBT_global_hook = SetWindowsHookExA ( WH_MOUSE_LL , cbt_global_hook_proc , GetModuleHandleA ( 0 ) , 0 ) ;
2006-05-24 08:53:24 +02:00
/* WH_MOUSE_LL is not supported on Win9x platforms */
if ( ! hCBT_global_hook )
{
2009-02-23 10:41:03 +01:00
win_skip ( " Skipping WH_MOUSE_LL test on this platform \n " ) ;
2006-05-24 08:53:24 +02:00
goto skip_mouse_ll_hook_test ;
}
2006-01-30 14:56:17 +01:00
hevent = CreateEventA ( NULL , 0 , 0 , NULL ) ;
assert ( hevent ) ;
2009-02-05 09:53:39 +01:00
hwnd2 = hevent ;
2006-01-30 14:56:17 +01:00
hthread = CreateThread ( NULL , 0 , mouse_ll_global_thread_proc , & hwnd2 , 0 , & tid ) ;
2006-10-07 21:45:11 +02:00
ok ( hthread ! = NULL , " CreateThread failed, error %d \n " , GetLastError ( ) ) ;
2006-01-30 14:56:17 +01:00
while ( WaitForSingleObject ( hevent , 100 ) = = WAIT_TIMEOUT )
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
ok_sequence ( WmMouseLLHookSeq , " MOUSE_LL hook other thread " , FALSE ) ;
flush_sequence ( ) ;
2006-05-23 11:58:00 +02:00
mouse_event ( MOUSEEVENTF_MOVE , - 1 , 0 , 0 , 0 ) ;
2006-01-30 14:56:17 +01:00
mouse_event ( MOUSEEVENTF_LEFTUP , 0 , 0 , 0 , 0 ) ;
2006-05-23 11:58:00 +02:00
mouse_event ( MOUSEEVENTF_MOVE , 1 , 0 , 0 , 0 ) ;
2006-01-30 14:56:17 +01:00
ok_sequence ( WmMouseLLHookSeq , " MOUSE_LL hook same thread " , FALSE ) ;
ret = UnhookWindowsHookEx ( hCBT_global_hook ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " UnhookWindowsHookEx error %d \n " , GetLastError ( ) ) ;
2006-01-30 14:56:17 +01:00
PostThreadMessageA ( tid , WM_QUIT , 0 , 0 ) ;
ok ( WaitForSingleObject ( hthread , INFINITE ) = = WAIT_OBJECT_0 , " WaitForSingleObject failed \n " ) ;
CloseHandle ( hthread ) ;
CloseHandle ( hevent ) ;
ok ( ! IsWindow ( hwnd2 ) , " window should be destroyed on thread exit \n " ) ;
/****** end of MOUSE_LL hook test *************/
2006-05-24 08:53:24 +02:00
skip_mouse_ll_hook_test :
2006-01-30 14:56:17 +01:00
2005-01-06 21:43:34 +01:00
ok ( DestroyWindow ( hwnd ) , " failed to destroy window \n " ) ;
}
2005-01-27 12:14:19 +01:00
static void test_set_hook ( void )
{
2005-03-31 21:07:08 +02:00
BOOL ret ;
2005-01-27 12:14:19 +01:00
HHOOK hhook ;
HWINEVENTHOOK hwinevent_hook ;
hhook = SetWindowsHookExA ( WH_CBT , cbt_hook_proc , GetModuleHandleA ( 0 ) , GetCurrentThreadId ( ) ) ;
ok ( hhook ! = 0 , " local hook does not require hModule set to 0 \n " ) ;
UnhookWindowsHookEx ( hhook ) ;
2006-12-14 18:10:47 +01:00
if ( 0 )
{
/* this test doesn't pass under Win9x: BUG! */
2005-01-27 12:14:19 +01:00
SetLastError ( 0xdeadbeef ) ;
hhook = SetWindowsHookExA ( WH_CBT , cbt_hook_proc , 0 , 0 ) ;
ok ( ! hhook , " global hook requires hModule != 0 \n " ) ;
2006-12-14 18:10:47 +01:00
ok ( GetLastError ( ) = = ERROR_HOOK_NEEDS_HMOD , " unexpected error %d \n " , GetLastError ( ) ) ;
}
2005-01-27 12:14:19 +01:00
SetLastError ( 0xdeadbeef ) ;
hhook = SetWindowsHookExA ( WH_CBT , 0 , GetModuleHandleA ( 0 ) , GetCurrentThreadId ( ) ) ;
ok ( ! hhook , " SetWinEventHook with invalid proc should fail \n " ) ;
ok ( GetLastError ( ) = = ERROR_INVALID_FILTER_PROC | | /* Win2k */
GetLastError ( ) = = 0xdeadbeef , /* Win9x */
2006-10-07 21:45:11 +02:00
" unexpected error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
SetLastError ( 0xdeadbeef ) ;
ok ( ! UnhookWindowsHookEx ( ( HHOOK ) 0xdeadbeef ) , " UnhookWindowsHookEx succeeded \n " ) ;
ok ( GetLastError ( ) = = ERROR_INVALID_HOOK_HANDLE | | /* Win2k */
GetLastError ( ) = = 0xdeadbeef , /* Win9x */
2006-10-07 21:45:11 +02:00
" unexpected error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
if ( ! pSetWinEventHook | | ! pUnhookWinEvent ) return ;
/* even process local incontext hooks require hmodule */
SetLastError ( 0xdeadbeef ) ;
2009-02-05 09:53:39 +01:00
hwinevent_hook = pSetWinEventHook ( EVENT_MIN , EVENT_MAX , 0 , win_event_proc ,
GetCurrentProcessId ( ) , 0 , WINEVENT_INCONTEXT ) ;
2005-01-27 12:14:19 +01:00
ok ( ! hwinevent_hook , " WINEVENT_INCONTEXT requires hModule != 0 \n " ) ;
ok ( GetLastError ( ) = = ERROR_HOOK_NEEDS_HMOD | | /* Win2k */
GetLastError ( ) = = 0xdeadbeef , /* Win9x */
2006-10-07 21:45:11 +02:00
" unexpected error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
/* even thread local incontext hooks require hmodule */
SetLastError ( 0xdeadbeef ) ;
2009-02-05 09:53:39 +01:00
hwinevent_hook = pSetWinEventHook ( EVENT_MIN , EVENT_MAX , 0 , win_event_proc ,
GetCurrentProcessId ( ) , GetCurrentThreadId ( ) , WINEVENT_INCONTEXT ) ;
2005-01-27 12:14:19 +01:00
ok ( ! hwinevent_hook , " WINEVENT_INCONTEXT requires hModule != 0 \n " ) ;
ok ( GetLastError ( ) = = ERROR_HOOK_NEEDS_HMOD | | /* Win2k */
GetLastError ( ) = = 0xdeadbeef , /* Win9x */
2006-10-07 21:45:11 +02:00
" unexpected error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
2006-12-14 18:10:47 +01:00
if ( 0 )
{
/* these 3 tests don't pass under Win9x */
2005-01-27 12:14:19 +01:00
SetLastError ( 0xdeadbeef ) ;
2009-02-05 09:53:39 +01:00
hwinevent_hook = pSetWinEventHook ( 1 , 0 , 0 , win_event_proc ,
GetCurrentProcessId ( ) , 0 , WINEVENT_OUTOFCONTEXT ) ;
2005-01-27 12:14:19 +01:00
ok ( ! hwinevent_hook , " SetWinEventHook with invalid event range should fail \n " ) ;
2006-12-14 18:10:47 +01:00
ok ( GetLastError ( ) = = ERROR_INVALID_HOOK_FILTER , " unexpected error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
SetLastError ( 0xdeadbeef ) ;
2009-02-05 09:53:39 +01:00
hwinevent_hook = pSetWinEventHook ( - 1 , 1 , 0 , win_event_proc ,
GetCurrentProcessId ( ) , 0 , WINEVENT_OUTOFCONTEXT ) ;
2005-01-27 12:14:19 +01:00
ok ( ! hwinevent_hook , " SetWinEventHook with invalid event range should fail \n " ) ;
2006-12-14 18:10:47 +01:00
ok ( GetLastError ( ) = = ERROR_INVALID_HOOK_FILTER , " unexpected error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
SetLastError ( 0xdeadbeef ) ;
2009-02-05 09:53:39 +01:00
hwinevent_hook = pSetWinEventHook ( EVENT_MIN , EVENT_MAX , 0 , win_event_proc ,
0 , 0xdeadbeef , WINEVENT_OUTOFCONTEXT ) ;
2005-01-27 12:14:19 +01:00
ok ( ! hwinevent_hook , " SetWinEventHook with invalid tid should fail \n " ) ;
2006-12-14 18:10:47 +01:00
ok ( GetLastError ( ) = = ERROR_INVALID_THREAD_ID , " unexpected error %d \n " , GetLastError ( ) ) ;
}
2005-01-27 12:14:19 +01:00
SetLastError ( 0xdeadbeef ) ;
2009-02-05 09:53:39 +01:00
hwinevent_hook = pSetWinEventHook ( 0 , 0 , 0 , win_event_proc ,
GetCurrentProcessId ( ) , 0 , WINEVENT_OUTOFCONTEXT ) ;
2006-10-07 21:45:11 +02:00
ok ( hwinevent_hook ! = 0 , " SetWinEventHook error %d \n " , GetLastError ( ) ) ;
ok ( GetLastError ( ) = = 0xdeadbeef , " unexpected error %d \n " , GetLastError ( ) ) ;
2005-03-31 21:07:08 +02:00
ret = pUnhookWinEvent ( hwinevent_hook ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " UnhookWinEvent error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
2005-02-03 17:40:20 +01:00
todo_wine {
/* This call succeeds under win2k SP4, but fails under Wine.
Does win2k test / use passed process id ? */
2005-01-27 12:14:19 +01:00
SetLastError ( 0xdeadbeef ) ;
2009-02-05 09:53:39 +01:00
hwinevent_hook = pSetWinEventHook ( EVENT_MIN , EVENT_MAX , 0 , win_event_proc ,
0xdeadbeef , 0 , WINEVENT_OUTOFCONTEXT ) ;
2006-10-07 21:45:11 +02:00
ok ( hwinevent_hook ! = 0 , " SetWinEventHook error %d \n " , GetLastError ( ) ) ;
ok ( GetLastError ( ) = = 0xdeadbeef , " unexpected error %d \n " , GetLastError ( ) ) ;
2005-03-31 21:07:08 +02:00
ret = pUnhookWinEvent ( hwinevent_hook ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " UnhookWinEvent error %d \n " , GetLastError ( ) ) ;
2005-02-03 17:40:20 +01:00
}
2005-01-27 12:14:19 +01:00
SetLastError ( 0xdeadbeef ) ;
ok ( ! pUnhookWinEvent ( ( HWINEVENTHOOK ) 0xdeadbeef ) , " UnhookWinEvent succeeded \n " ) ;
ok ( GetLastError ( ) = = ERROR_INVALID_HANDLE | | /* Win2k */
GetLastError ( ) = = 0xdeadbeef , /* Win9x */
2006-10-07 21:45:11 +02:00
" unexpected error %d \n " , GetLastError ( ) ) ;
2005-01-27 12:14:19 +01:00
}
2005-02-08 15:27:39 +01:00
static const struct message ScrollWindowPaint1 [ ] = {
{ WM_PAINT , sent } ,
{ WM_ERASEBKGND , sent | beginpaint } ,
2009-02-21 12:57:23 +01:00
{ WM_GETTEXTLENGTH , sent | optional } ,
2009-03-03 13:20:49 +01:00
{ WM_PAINT , sent | optional } ,
2009-03-05 14:26:55 +01:00
{ WM_NCPAINT , sent | beginpaint | optional } ,
2009-03-11 11:42:21 +01:00
{ WM_GETTEXT , sent | beginpaint | optional } ,
{ WM_GETTEXT , sent | beginpaint | optional } ,
2009-03-13 11:29:53 +01:00
{ WM_GETTEXT , sent | beginpaint | optional } ,
2009-05-13 11:54:55 +02:00
{ WM_GETTEXT , sent | beginpaint | defwinproc | optional } ,
2009-03-11 11:42:21 +01:00
{ WM_ERASEBKGND , sent | beginpaint | optional } ,
2005-02-08 15:27:39 +01:00
{ 0 }
} ;
static const struct message ScrollWindowPaint2 [ ] = {
{ WM_PAINT , sent } ,
{ 0 }
} ;
static void test_scrollwindowex ( void )
{
HWND hwnd , hchild ;
RECT rect = { 0 , 0 , 130 , 130 } ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test Scroll " ,
WS_VISIBLE | WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
hchild = CreateWindowExA ( 0 , " TestWindowClass " , " Test child " ,
WS_VISIBLE | WS_CAPTION | WS_CHILD ,
10 , 10 , 150 , 150 , hwnd , 0 , 0 , NULL ) ;
ok ( hchild ! = 0 , " Failed to create child \n " ) ;
UpdateWindow ( hwnd ) ;
2006-03-15 12:11:02 +01:00
flush_events ( ) ;
2005-02-08 15:27:39 +01:00
flush_sequence ( ) ;
/* scroll without the child window */
trace ( " start scroll \n " ) ;
ScrollWindowEx ( hwnd , 10 , 10 , & rect , NULL , NULL , NULL ,
SW_ERASE | SW_INVALIDATE ) ;
2005-02-22 17:02:58 +01:00
ok_sequence ( WmEmptySeq , " ScrollWindowEx " , 0 ) ;
2005-02-08 15:27:39 +01:00
trace ( " end scroll \n " ) ;
flush_sequence ( ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-02-22 17:02:58 +01:00
ok_sequence ( ScrollWindowPaint1 , " ScrollWindowEx " , 0 ) ;
2006-10-28 10:42:56 +02:00
flush_events ( ) ;
flush_sequence ( ) ;
2005-02-08 15:27:39 +01:00
/* Now without the SW_ERASE flag */
trace ( " start scroll \n " ) ;
ScrollWindowEx ( hwnd , 10 , 10 , & rect , NULL , NULL , NULL , SW_INVALIDATE ) ;
2005-02-22 17:02:58 +01:00
ok_sequence ( WmEmptySeq , " ScrollWindowEx " , 0 ) ;
2005-02-08 15:27:39 +01:00
trace ( " end scroll \n " ) ;
flush_sequence ( ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-02-22 17:02:58 +01:00
ok_sequence ( ScrollWindowPaint2 , " ScrollWindowEx " , 0 ) ;
2006-10-28 10:42:56 +02:00
flush_events ( ) ;
flush_sequence ( ) ;
2005-02-08 15:27:39 +01:00
/* now scroll the child window as well */
trace ( " start scroll \n " ) ;
ScrollWindowEx ( hwnd , 10 , 10 , & rect , NULL , NULL , NULL ,
SW_SCROLLCHILDREN | SW_ERASE | SW_INVALIDATE ) ;
2009-01-12 21:51:01 +01:00
/* wine sends WM_POSCHANGING, WM_POSCHANGED messages */
/* windows sometimes a WM_MOVE */
ok_sequence ( WmEmptySeq , " ScrollWindowEx " , TRUE ) ;
2005-02-08 15:27:39 +01:00
trace ( " end scroll \n " ) ;
flush_sequence ( ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-02-22 17:02:58 +01:00
ok_sequence ( ScrollWindowPaint1 , " ScrollWindowEx " , 0 ) ;
2006-10-28 10:42:56 +02:00
flush_events ( ) ;
flush_sequence ( ) ;
2005-02-08 15:27:39 +01:00
2005-03-29 15:06:32 +02:00
/* now scroll with ScrollWindow() */
trace ( " start scroll with ScrollWindow \n " ) ;
ScrollWindow ( hwnd , 5 , 5 , NULL , NULL ) ;
trace ( " end scroll \n " ) ;
flush_sequence ( ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-03-29 15:06:32 +02:00
ok_sequence ( ScrollWindowPaint1 , " ScrollWindow " , 0 ) ;
2005-02-08 15:27:39 +01:00
ok ( DestroyWindow ( hchild ) , " failed to destroy window \n " ) ;
ok ( DestroyWindow ( hwnd ) , " failed to destroy window \n " ) ;
flush_sequence ( ) ;
}
2005-02-18 21:01:41 +01:00
static const struct message destroy_window_with_children [ ] = {
2005-03-14 18:15:33 +01:00
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , 0 , 0 } , /* popup */
2005-02-18 21:01:41 +01:00
{ HCBT_DESTROYWND , hook | lparam , 0 , WND_PARENT_ID } , /* parent */
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2005-02-18 21:01:41 +01:00
{ HCBT_DESTROYWND , hook | lparam , 0 , WND_POPUP_ID } , /* popup */
2008-03-04 20:00:13 +01:00
{ 0x0090 , sent | optional } ,
2005-02-21 19:33:27 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } , /* popup */
2005-02-18 21:01:41 +01:00
{ WM_DESTROY , sent | wparam | lparam , 0 , WND_POPUP_ID } , /* popup */
2005-03-14 18:15:33 +01:00
{ WM_CAPTURECHANGED , sent | wparam | lparam , 0 , WND_POPUP_ID } , /* popup */
2005-02-18 21:01:41 +01:00
{ WM_NCDESTROY , sent | wparam | lparam , 0 , WND_POPUP_ID } , /* popup */
2005-02-21 19:33:27 +01:00
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , 0 , 0 } , /* parent */
2005-02-18 21:01:41 +01:00
{ WM_DESTROY , sent | wparam | lparam , 0 , WND_PARENT_ID } , /* parent */
{ WM_DESTROY , sent | wparam | lparam , 0 , WND_CHILD_ID + 2 } , /* child2 */
{ WM_DESTROY , sent | wparam | lparam , 0 , WND_CHILD_ID + 1 } , /* child1 */
{ WM_DESTROY , sent | wparam | lparam , 0 , WND_CHILD_ID + 3 } , /* child3 */
{ WM_NCDESTROY , sent | wparam | lparam , 0 , WND_CHILD_ID + 2 } , /* child2 */
{ WM_NCDESTROY , sent | wparam | lparam , 0 , WND_CHILD_ID + 3 } , /* child3 */
{ WM_NCDESTROY , sent | wparam | lparam , 0 , WND_CHILD_ID + 1 } , /* child1 */
{ WM_NCDESTROY , sent | wparam | lparam , 0 , WND_PARENT_ID } , /* parent */
{ 0 }
} ;
static void test_DestroyWindow ( void )
{
2005-03-31 21:07:08 +02:00
BOOL ret ;
2005-02-18 21:01:41 +01:00
HWND parent , child1 , child2 , child3 , child4 , test ;
2009-01-08 13:18:01 +01:00
UINT_PTR child_id = WND_CHILD_ID + 1 ;
2005-02-18 21:01:41 +01:00
parent = CreateWindowExA ( 0 , " TestWindowClass " , NULL , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
assert ( parent ! = 0 ) ;
child1 = CreateWindowExA ( 0 , " TestWindowClass " , NULL , WS_CHILD ,
0 , 0 , 50 , 50 , parent , ( HMENU ) child_id + + , 0 , NULL ) ;
assert ( child1 ! = 0 ) ;
child2 = CreateWindowExA ( 0 , " TestWindowClass " , NULL , WS_CHILD ,
0 , 0 , 50 , 50 , GetDesktopWindow ( ) , ( HMENU ) child_id + + , 0 , NULL ) ;
assert ( child2 ! = 0 ) ;
child3 = CreateWindowExA ( 0 , " TestWindowClass " , NULL , WS_CHILD ,
0 , 0 , 50 , 50 , child1 , ( HMENU ) child_id + + , 0 , NULL ) ;
assert ( child3 ! = 0 ) ;
child4 = CreateWindowExA ( 0 , " TestWindowClass " , NULL , WS_POPUP ,
0 , 0 , 50 , 50 , parent , 0 , 0 , NULL ) ;
assert ( child4 ! = 0 ) ;
/* test owner/parent of child2 */
test = GetParent ( child2 ) ;
ok ( test = = GetDesktopWindow ( ) , " wrong parent %p \n " , test ) ;
2005-03-02 11:11:06 +01:00
ok ( ! IsChild ( parent , child2 ) , " wrong parent/child %p/%p \n " , parent , child2 ) ;
2005-02-22 16:43:54 +01:00
if ( pGetAncestor ) {
test = pGetAncestor ( child2 , GA_PARENT ) ;
2005-02-22 17:02:58 +01:00
ok ( test = = GetDesktopWindow ( ) , " wrong parent %p \n " , test ) ;
2005-02-22 16:43:54 +01:00
}
2005-02-18 21:01:41 +01:00
test = GetWindow ( child2 , GW_OWNER ) ;
ok ( ! test , " wrong owner %p \n " , test ) ;
test = SetParent ( child2 , parent ) ;
ok ( test = = GetDesktopWindow ( ) , " wrong old parent %p \n " , test ) ;
/* test owner/parent of the parent */
test = GetParent ( parent ) ;
ok ( ! test , " wrong parent %p \n " , test ) ;
2005-03-02 11:11:06 +01:00
ok ( ! IsChild ( GetDesktopWindow ( ) , parent ) , " wrong parent/child %p/%p \n " , GetDesktopWindow ( ) , parent ) ;
2005-02-22 16:43:54 +01:00
if ( pGetAncestor ) {
test = pGetAncestor ( parent , GA_PARENT ) ;
2005-02-22 17:02:58 +01:00
ok ( test = = GetDesktopWindow ( ) , " wrong parent %p \n " , test ) ;
2005-02-22 16:43:54 +01:00
}
2005-02-18 21:01:41 +01:00
test = GetWindow ( parent , GW_OWNER ) ;
ok ( ! test , " wrong owner %p \n " , test ) ;
/* test owner/parent of child1 */
test = GetParent ( child1 ) ;
ok ( test = = parent , " wrong parent %p \n " , test ) ;
2005-03-02 11:11:06 +01:00
ok ( IsChild ( parent , child1 ) , " wrong parent/child %p/%p \n " , parent , child1 ) ;
2005-02-22 16:43:54 +01:00
if ( pGetAncestor ) {
test = pGetAncestor ( child1 , GA_PARENT ) ;
2005-02-22 17:02:58 +01:00
ok ( test = = parent , " wrong parent %p \n " , test ) ;
2005-02-22 16:43:54 +01:00
}
2005-02-18 21:01:41 +01:00
test = GetWindow ( child1 , GW_OWNER ) ;
ok ( ! test , " wrong owner %p \n " , test ) ;
/* test owner/parent of child2 */
test = GetParent ( child2 ) ;
ok ( test = = parent , " wrong parent %p \n " , test ) ;
2005-03-02 11:11:06 +01:00
ok ( IsChild ( parent , child2 ) , " wrong parent/child %p/%p \n " , parent , child2 ) ;
2005-02-22 16:43:54 +01:00
if ( pGetAncestor ) {
test = pGetAncestor ( child2 , GA_PARENT ) ;
2005-02-22 17:02:58 +01:00
ok ( test = = parent , " wrong parent %p \n " , test ) ;
2005-02-22 16:43:54 +01:00
}
2005-02-18 21:01:41 +01:00
test = GetWindow ( child2 , GW_OWNER ) ;
ok ( ! test , " wrong owner %p \n " , test ) ;
/* test owner/parent of child3 */
test = GetParent ( child3 ) ;
ok ( test = = child1 , " wrong parent %p \n " , test ) ;
2005-03-02 11:11:06 +01:00
ok ( IsChild ( parent , child3 ) , " wrong parent/child %p/%p \n " , parent , child3 ) ;
2005-02-22 16:43:54 +01:00
if ( pGetAncestor ) {
test = pGetAncestor ( child3 , GA_PARENT ) ;
2005-02-22 17:02:58 +01:00
ok ( test = = child1 , " wrong parent %p \n " , test ) ;
2005-02-22 16:43:54 +01:00
}
2005-02-18 21:01:41 +01:00
test = GetWindow ( child3 , GW_OWNER ) ;
ok ( ! test , " wrong owner %p \n " , test ) ;
/* test owner/parent of child4 */
test = GetParent ( child4 ) ;
ok ( test = = parent , " wrong parent %p \n " , test ) ;
2005-03-02 11:11:06 +01:00
ok ( ! IsChild ( parent , child4 ) , " wrong parent/child %p/%p \n " , parent , child4 ) ;
2005-02-22 16:43:54 +01:00
if ( pGetAncestor ) {
test = pGetAncestor ( child4 , GA_PARENT ) ;
2005-02-22 17:02:58 +01:00
ok ( test = = GetDesktopWindow ( ) , " wrong parent %p \n " , test ) ;
2005-02-22 16:43:54 +01:00
}
2005-02-18 21:01:41 +01:00
test = GetWindow ( child4 , GW_OWNER ) ;
ok ( test = = parent , " wrong owner %p \n " , test ) ;
flush_sequence ( ) ;
trace ( " parent %p, child1 %p, child2 %p, child3 %p, child4 %p \n " ,
parent , child1 , child2 , child3 , child4 ) ;
2005-03-14 18:15:33 +01:00
SetCapture ( child4 ) ;
2005-02-24 18:03:51 +01:00
test = GetCapture ( ) ;
2005-03-14 18:15:33 +01:00
ok ( test = = child4 , " wrong capture window %p \n " , test ) ;
2005-02-24 18:03:51 +01:00
2005-02-18 21:01:41 +01:00
test_DestroyWindow_flag = TRUE ;
2005-03-31 21:07:08 +02:00
ret = DestroyWindow ( parent ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " DestroyWindow() error %d \n " , GetLastError ( ) ) ;
2005-02-18 21:01:41 +01:00
test_DestroyWindow_flag = FALSE ;
2005-02-22 17:02:58 +01:00
ok_sequence ( destroy_window_with_children , " destroy window with children " , 0 ) ;
2005-02-18 21:01:41 +01:00
2005-03-02 11:11:06 +01:00
ok ( ! IsWindow ( parent ) , " parent still exists \n " ) ;
ok ( ! IsWindow ( child1 ) , " child1 still exists \n " ) ;
ok ( ! IsWindow ( child2 ) , " child2 still exists \n " ) ;
ok ( ! IsWindow ( child3 ) , " child3 still exists \n " ) ;
ok ( ! IsWindow ( child4 ) , " child4 still exists \n " ) ;
2005-02-24 18:03:51 +01:00
test = GetCapture ( ) ;
ok ( ! test , " wrong capture window %p \n " , test ) ;
2005-02-18 21:01:41 +01:00
}
2005-02-22 15:58:52 +01:00
static const struct message WmDispatchPaint [ ] = {
{ WM_NCPAINT , sent } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent } ,
{ 0 }
} ;
static LRESULT WINAPI DispatchMessageCheckProc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2005-10-26 12:11:52 +02:00
if ( message = = WM_PAINT ) return 0 ;
2005-02-22 15:58:52 +01:00
return MsgCheckProcA ( hwnd , message , wParam , lParam ) ;
}
static void test_DispatchMessage ( void )
{
RECT rect ;
MSG msg ;
int count ;
HWND hwnd = CreateWindowA ( " TestWindowClass " , NULL , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-02-22 15:58:52 +01:00
flush_sequence ( ) ;
2005-09-09 17:20:04 +02:00
SetWindowLongPtrA ( hwnd , GWLP_WNDPROC , ( LONG_PTR ) DispatchMessageCheckProc ) ;
2005-02-22 15:58:52 +01:00
SetRect ( & rect , - 5 , - 5 , 5 , 5 ) ;
RedrawWindow ( hwnd , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
count = 0 ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) )
{
if ( msg . message ! = WM_PAINT ) DispatchMessage ( & msg ) ;
else
{
flush_sequence ( ) ;
DispatchMessage ( & msg ) ;
/* DispatchMessage will send WM_NCPAINT if non client area is still invalid after WM_PAINT */
if ( ! count ) ok_sequence ( WmDispatchPaint , " WmDispatchPaint " , FALSE ) ;
else ok_sequence ( WmEmptySeq , " WmEmpty " , FALSE ) ;
if ( + + count > 10 ) break ;
}
}
ok ( msg . message = = WM_PAINT & & count > 10 , " WM_PAINT messages stopped \n " ) ;
trace ( " now without DispatchMessage \n " ) ;
flush_sequence ( ) ;
RedrawWindow ( hwnd , & rect , 0 , RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ) ;
count = 0 ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) )
{
if ( msg . message ! = WM_PAINT ) DispatchMessage ( & msg ) ;
else
{
HRGN hrgn = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
flush_sequence ( ) ;
/* this will send WM_NCCPAINT just like DispatchMessage does */
GetUpdateRgn ( hwnd , hrgn , TRUE ) ;
ok_sequence ( WmDispatchPaint , " WmDispatchPaint " , FALSE ) ;
DeleteObject ( hrgn ) ;
GetClientRect ( hwnd , & rect ) ;
ValidateRect ( hwnd , & rect ) ; /* this will stop WM_PAINTs */
ok ( ! count , " Got multiple WM_PAINTs \n " ) ;
if ( + + count > 10 ) break ;
}
}
2006-03-15 12:11:02 +01:00
DestroyWindow ( hwnd ) ;
2005-02-22 15:58:52 +01:00
}
2005-09-13 16:46:46 +02:00
static const struct message WmUser [ ] = {
{ WM_USER , sent } ,
{ 0 }
} ;
2006-02-23 17:57:59 +01:00
struct sendmsg_info
2005-09-13 16:46:46 +02:00
{
HWND hwnd ;
DWORD timeout ;
DWORD ret ;
} ;
static DWORD CALLBACK send_msg_thread ( LPVOID arg )
{
2006-02-23 17:57:59 +01:00
struct sendmsg_info * info = arg ;
2008-09-19 12:07:18 +02:00
SetLastError ( 0xdeadbeef ) ;
2005-09-13 16:46:46 +02:00
info - > ret = SendMessageTimeoutA ( info - > hwnd , WM_USER , 0 , 0 , 0 , info - > timeout , NULL ) ;
2008-09-22 12:14:56 +02:00
if ( ! info - > ret ) ok ( GetLastError ( ) = = ERROR_TIMEOUT | |
broken ( GetLastError ( ) = = 0 ) , /* win9x */
" unexpected error %d \n " , GetLastError ( ) ) ;
2005-09-13 16:46:46 +02:00
return 0 ;
}
static void wait_for_thread ( HANDLE thread )
{
while ( MsgWaitForMultipleObjects ( 1 , & thread , FALSE , INFINITE , QS_SENDMESSAGE ) ! = WAIT_OBJECT_0 )
{
MSG msg ;
while ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
}
}
static LRESULT WINAPI send_msg_delay_proc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
if ( message = = WM_USER ) Sleep ( 200 ) ;
return MsgCheckProcA ( hwnd , message , wParam , lParam ) ;
}
static void test_SendMessageTimeout ( void )
{
HANDLE thread ;
2006-02-23 17:57:59 +01:00
struct sendmsg_info info ;
2005-10-28 12:41:48 +02:00
DWORD tid ;
2008-09-22 12:14:56 +02:00
BOOL is_win9x ;
2005-09-13 16:46:46 +02:00
info . hwnd = CreateWindowA ( " TestWindowClass " , NULL , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-09-13 16:46:46 +02:00
flush_sequence ( ) ;
info . timeout = 1000 ;
info . ret = 0xdeadbeef ;
2005-10-28 12:41:48 +02:00
thread = CreateThread ( NULL , 0 , send_msg_thread , & info , 0 , & tid ) ;
2005-09-13 16:46:46 +02:00
wait_for_thread ( thread ) ;
CloseHandle ( thread ) ;
ok ( info . ret = = 1 , " SendMessageTimeout failed \n " ) ;
ok_sequence ( WmUser , " WmUser " , FALSE ) ;
info . timeout = 1 ;
info . ret = 0xdeadbeef ;
2005-10-28 12:41:48 +02:00
thread = CreateThread ( NULL , 0 , send_msg_thread , & info , 0 , & tid ) ;
2007-12-07 01:03:54 +01:00
Sleep ( 100 ) ; /* SendMessageTimeout should time out here */
2005-09-13 16:46:46 +02:00
wait_for_thread ( thread ) ;
CloseHandle ( thread ) ;
ok ( info . ret = = 0 , " SendMessageTimeout succeeded \n " ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2008-09-22 12:14:56 +02:00
/* 0 means infinite timeout (but not on win9x) */
2005-09-13 16:46:46 +02:00
info . timeout = 0 ;
info . ret = 0xdeadbeef ;
2005-10-28 12:41:48 +02:00
thread = CreateThread ( NULL , 0 , send_msg_thread , & info , 0 , & tid ) ;
2005-09-13 16:46:46 +02:00
Sleep ( 100 ) ;
wait_for_thread ( thread ) ;
CloseHandle ( thread ) ;
2008-09-22 12:14:56 +02:00
is_win9x = ! info . ret ;
if ( is_win9x ) ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
else ok_sequence ( WmUser , " WmUser " , FALSE ) ;
2005-09-13 16:46:46 +02:00
2008-09-22 12:14:56 +02:00
/* timeout is treated as signed despite the prototype (but not on win9x) */
2005-09-13 16:46:46 +02:00
info . timeout = 0x7fffffff ;
info . ret = 0xdeadbeef ;
2005-10-28 12:41:48 +02:00
thread = CreateThread ( NULL , 0 , send_msg_thread , & info , 0 , & tid ) ;
2005-09-13 16:46:46 +02:00
Sleep ( 100 ) ;
wait_for_thread ( thread ) ;
CloseHandle ( thread ) ;
ok ( info . ret = = 1 , " SendMessageTimeout failed \n " ) ;
ok_sequence ( WmUser , " WmUser " , FALSE ) ;
info . timeout = 0x80000000 ;
info . ret = 0xdeadbeef ;
2005-10-28 12:41:48 +02:00
thread = CreateThread ( NULL , 0 , send_msg_thread , & info , 0 , & tid ) ;
2005-09-13 16:46:46 +02:00
Sleep ( 100 ) ;
wait_for_thread ( thread ) ;
CloseHandle ( thread ) ;
2008-09-22 12:14:56 +02:00
if ( is_win9x )
{
ok ( info . ret = = 1 , " SendMessageTimeout failed \n " ) ;
ok_sequence ( WmUser , " WmUser " , FALSE ) ;
}
else
{
ok ( info . ret = = 0 , " SendMessageTimeout succeeded \n " ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
}
2005-09-13 16:46:46 +02:00
/* now check for timeout during message processing */
SetWindowLongPtrA ( info . hwnd , GWLP_WNDPROC , ( LONG_PTR ) send_msg_delay_proc ) ;
info . timeout = 100 ;
info . ret = 0xdeadbeef ;
2005-10-28 12:41:48 +02:00
thread = CreateThread ( NULL , 0 , send_msg_thread , & info , 0 , & tid ) ;
2005-09-13 16:46:46 +02:00
wait_for_thread ( thread ) ;
CloseHandle ( thread ) ;
2007-12-07 01:03:54 +01:00
/* we should time out but still get the message */
2005-09-13 16:46:46 +02:00
ok ( info . ret = = 0 , " SendMessageTimeout failed \n " ) ;
ok_sequence ( WmUser , " WmUser " , FALSE ) ;
DestroyWindow ( info . hwnd ) ;
}
2005-11-16 12:22:54 +01:00
/****************** edit message test *************************/
# define ID_EDIT 0x1234
static const struct message sl_edit_setfocus [ ] =
{
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-11-16 12:22:54 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent | wparam , 0 } ,
2008-03-04 20:00:13 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 10 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 15 } ,
2005-11-16 12:22:54 +01:00
{ WM_CTLCOLOREDIT , sent | parent } ,
2008-03-04 20:00:13 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 11 } ,
2005-11-16 12:22:54 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ WM_COMMAND , sent | parent | wparam , MAKEWPARAM ( ID_EDIT , EN_SETFOCUS ) } ,
{ 0 }
} ;
static const struct message ml_edit_setfocus [ ] =
{
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-11-16 12:22:54 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent | wparam , 0 } ,
2008-03-04 20:00:13 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 10 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 11 } ,
2005-11-16 12:22:54 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ WM_COMMAND , sent | parent | wparam , MAKEWPARAM ( ID_EDIT , EN_SETFOCUS ) } ,
{ 0 }
} ;
static const struct message sl_edit_killfocus [ ] =
{
{ HCBT_SETFOCUS , hook } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_KILLFOCUS , sent | wparam , 0 } ,
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_DESTROY , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ WM_COMMAND , sent | parent | wparam , MAKEWPARAM ( ID_EDIT , EN_KILLFOCUS ) } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 1 } ,
2005-11-16 12:22:54 +01:00
{ 0 }
} ;
static const struct message sl_edit_lbutton_dblclk [ ] =
{
{ WM_LBUTTONDBLCLK , sent } ,
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message sl_edit_lbutton_down [ ] =
{
{ WM_LBUTTONDOWN , sent | wparam | lparam , 0 , 0 } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-11-16 12:22:54 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-03-04 20:00:13 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 10 } ,
2005-11-16 12:22:54 +01:00
{ WM_CTLCOLOREDIT , sent | parent } ,
2008-03-04 20:00:13 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 11 } ,
2005-11-16 12:22:54 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ WM_COMMAND , sent | parent | wparam , MAKEWPARAM ( ID_EDIT , EN_SETFOCUS ) } ,
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
2007-09-25 12:26:57 +02:00
{ WM_CTLCOLOREDIT , sent | parent | optional } ,
2008-03-04 20:00:13 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 11 } ,
2005-11-16 12:22:54 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ 0 }
} ;
static const struct message ml_edit_lbutton_down [ ] =
{
{ WM_LBUTTONDOWN , sent | wparam | lparam , 0 , 0 } ,
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2005-11-16 12:22:54 +01:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent | wparam | defwinproc , 0 } ,
2008-03-04 20:00:13 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 10 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 11 } ,
2005-11-16 12:22:54 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ WM_COMMAND , sent | parent | wparam , MAKEWPARAM ( ID_EDIT , EN_SETFOCUS ) } ,
{ 0 }
} ;
static const struct message sl_edit_lbutton_up [ ] =
{
{ WM_LBUTTONUP , sent | wparam | lparam , 0 , 0 } ,
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_SYSTEM_CAPTUREEND , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_CAPTURECHANGED , sent | defwinproc } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ 0 }
} ;
static const struct message ml_edit_lbutton_up [ ] =
{
{ WM_LBUTTONUP , sent | wparam | lparam , 0 , 0 } ,
{ EVENT_SYSTEM_CAPTUREEND , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_CAPTURECHANGED , sent | defwinproc } ,
{ 0 }
} ;
static WNDPROC old_edit_proc ;
static LRESULT CALLBACK edit_hook_proc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-10-02 12:18:42 +02:00
static LONG defwndproc_counter = 0 ;
2005-11-16 12:22:54 +01:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2005-11-16 12:22:54 +01:00
2009-05-12 12:09:30 +02:00
if ( ignore_message ( message ) ) return 0 ;
2005-11-16 12:22:54 +01:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2005-11-16 12:22:54 +01:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
if ( defwndproc_counter ) msg . flags | = defwinproc ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " edit " ;
2005-11-16 12:22:54 +01:00
add_message ( & msg ) ;
defwndproc_counter + + ;
ret = CallWindowProcA ( old_edit_proc , hwnd , message , wParam , lParam ) ;
defwndproc_counter - - ;
return ret ;
}
static void subclass_edit ( void )
{
WNDCLASSA cls ;
if ( ! GetClassInfoA ( 0 , " edit " , & cls ) ) assert ( 0 ) ;
old_edit_proc = cls . lpfnWndProc ;
cls . hInstance = GetModuleHandle ( 0 ) ;
cls . lpfnWndProc = edit_hook_proc ;
cls . lpszClassName = " my_edit_class " ;
2007-02-20 10:06:21 +01:00
UnregisterClass ( cls . lpszClassName , cls . hInstance ) ;
2005-11-16 12:22:54 +01:00
if ( ! RegisterClassA ( & cls ) ) assert ( 0 ) ;
}
static void test_edit_messages ( void )
{
HWND hwnd , parent ;
DWORD dlg_code ;
subclass_edit ( ) ;
log_all_parent_messages + + ;
parent = CreateWindowExA ( 0 , " TestParentClass " , " Test parent " , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( parent ! = 0 , " Failed to create parent window \n " ) ;
/* test single line edit */
hwnd = CreateWindowExA ( 0 , " my_edit_class " , " test " , WS_CHILD ,
0 , 0 , 80 , 20 , parent , ( HMENU ) ID_EDIT , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create edit window \n " ) ;
dlg_code = SendMessageA ( hwnd , WM_GETDLGCODE , 0 , 0 ) ;
2006-10-07 21:45:11 +02:00
ok ( dlg_code = = ( DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS ) , " wrong dlg_code %08x \n " , dlg_code ) ;
2005-11-16 12:22:54 +01:00
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
SetFocus ( 0 ) ;
flush_sequence ( ) ;
SetFocus ( hwnd ) ;
ok_sequence ( sl_edit_setfocus , " SetFocus(hwnd) on an edit " , FALSE ) ;
SetFocus ( 0 ) ;
ok_sequence ( sl_edit_killfocus , " SetFocus(0) on an edit " , FALSE ) ;
SetFocus ( 0 ) ;
ReleaseCapture ( ) ;
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_LBUTTONDBLCLK , 0 , 0 ) ;
ok_sequence ( sl_edit_lbutton_dblclk , " WM_LBUTTONDBLCLK on an edit " , FALSE ) ;
SetFocus ( 0 ) ;
ReleaseCapture ( ) ;
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_LBUTTONDOWN , 0 , 0 ) ;
ok_sequence ( sl_edit_lbutton_down , " WM_LBUTTONDOWN on an edit " , FALSE ) ;
SendMessageA ( hwnd , WM_LBUTTONUP , 0 , 0 ) ;
ok_sequence ( sl_edit_lbutton_up , " WM_LBUTTONUP on an edit " , FALSE ) ;
DestroyWindow ( hwnd ) ;
/* test multiline edit */
hwnd = CreateWindowExA ( 0 , " my_edit_class " , " test " , WS_CHILD | ES_MULTILINE ,
0 , 0 , 80 , 20 , parent , ( HMENU ) ID_EDIT , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create edit window \n " ) ;
dlg_code = SendMessageA ( hwnd , WM_GETDLGCODE , 0 , 0 ) ;
ok ( dlg_code = = ( DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS | DLGC_WANTALLKEYS ) ,
2006-10-07 21:45:11 +02:00
" wrong dlg_code %08x \n " , dlg_code ) ;
2005-11-16 12:22:54 +01:00
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
SetFocus ( 0 ) ;
flush_sequence ( ) ;
SetFocus ( hwnd ) ;
ok_sequence ( ml_edit_setfocus , " SetFocus(hwnd) on multiline edit " , FALSE ) ;
SetFocus ( 0 ) ;
ok_sequence ( sl_edit_killfocus , " SetFocus(0) on multiline edit " , FALSE ) ;
SetFocus ( 0 ) ;
ReleaseCapture ( ) ;
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_LBUTTONDBLCLK , 0 , 0 ) ;
ok_sequence ( sl_edit_lbutton_dblclk , " WM_LBUTTONDBLCLK on multiline edit " , FALSE ) ;
SetFocus ( 0 ) ;
ReleaseCapture ( ) ;
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_LBUTTONDOWN , 0 , 0 ) ;
ok_sequence ( ml_edit_lbutton_down , " WM_LBUTTONDOWN on multiline edit " , FALSE ) ;
SendMessageA ( hwnd , WM_LBUTTONUP , 0 , 0 ) ;
ok_sequence ( ml_edit_lbutton_up , " WM_LBUTTONUP on multiline edit " , FALSE ) ;
DestroyWindow ( hwnd ) ;
DestroyWindow ( parent ) ;
log_all_parent_messages - - ;
}
/**************************** End of Edit test ******************************/
2006-10-28 10:24:13 +02:00
static const struct message WmKeyDownSkippedSeq [ ] =
{
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 1 } , /* XP */
{ 0 }
} ;
2009-01-12 18:03:14 +01:00
static const struct message WmKeyDownWasDownSkippedSeq [ ] =
{
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0x40000001 } , /* XP */
{ 0 }
} ;
2006-10-28 10:24:13 +02:00
static const struct message WmKeyUpSkippedSeq [ ] =
{
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xc0000001 } , /* XP */
{ 0 }
} ;
2009-01-12 18:03:14 +01:00
static const struct message WmUserKeyUpSkippedSeq [ ] =
{
{ WM_USER , sent } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' N ' , 0xc0000001 } , /* XP */
{ 0 }
} ;
2006-10-28 10:24:13 +02:00
2008-08-04 23:07:10 +02:00
# define EV_STOP 0
2005-12-22 13:58:11 +01:00
# define EV_SENDMSG 1
# define EV_ACK 2
2006-02-23 17:57:59 +01:00
struct peekmsg_info
2005-12-22 13:58:11 +01:00
{
HWND hwnd ;
HANDLE hevent [ 3 ] ; /* 0 - start/stop, 1 - SendMessage, 2 - ack */
} ;
static DWORD CALLBACK send_msg_thread_2 ( void * param )
{
DWORD ret ;
2006-02-23 17:57:59 +01:00
struct peekmsg_info * info = param ;
2005-12-22 13:58:11 +01:00
trace ( " thread: looping \n " ) ;
2008-08-04 23:07:10 +02:00
SetEvent ( info - > hevent [ EV_ACK ] ) ;
2005-12-22 13:58:11 +01:00
while ( 1 )
{
ret = WaitForMultipleObjects ( 2 , info - > hevent , FALSE , INFINITE ) ;
switch ( ret )
{
2008-08-04 23:07:10 +02:00
case WAIT_OBJECT_0 + EV_STOP :
2005-12-22 13:58:11 +01:00
trace ( " thread: exiting \n " ) ;
return 0 ;
case WAIT_OBJECT_0 + EV_SENDMSG :
trace ( " thread: sending message \n " ) ;
2008-08-04 23:07:10 +02:00
ok ( SendNotifyMessageA ( info - > hwnd , WM_USER , 0 , 0 ) ,
" SendNotifyMessageA failed error %u \n " , GetLastError ( ) ) ;
2005-12-22 13:58:11 +01:00
SetEvent ( info - > hevent [ EV_ACK ] ) ;
break ;
default :
2006-10-07 21:45:11 +02:00
trace ( " unexpected return: %04x \n " , ret ) ;
2005-12-22 13:58:11 +01:00
assert ( 0 ) ;
break ;
}
}
return 0 ;
}
static void test_PeekMessage ( void )
{
MSG msg ;
HANDLE hthread ;
DWORD tid , qstatus ;
UINT qs_all_input = QS_ALLINPUT ;
UINT qs_input = QS_INPUT ;
2006-05-24 08:53:24 +02:00
BOOL ret ;
2006-02-23 17:57:59 +01:00
struct peekmsg_info info ;
2005-12-22 13:58:11 +01:00
info . hwnd = CreateWindowA ( " TestWindowClass " , NULL , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
2006-05-24 08:53:24 +02:00
assert ( info . hwnd ) ;
2005-12-22 13:58:11 +01:00
ShowWindow ( info . hwnd , SW_SHOW ) ;
UpdateWindow ( info . hwnd ) ;
2006-05-24 08:53:24 +02:00
SetFocus ( info . hwnd ) ;
2005-12-22 13:58:11 +01:00
2008-08-04 23:07:10 +02:00
info . hevent [ EV_STOP ] = CreateEventA ( NULL , 0 , 0 , NULL ) ;
2005-12-22 13:58:11 +01:00
info . hevent [ EV_SENDMSG ] = CreateEventA ( NULL , 0 , 0 , NULL ) ;
info . hevent [ EV_ACK ] = CreateEventA ( NULL , 0 , 0 , NULL ) ;
hthread = CreateThread ( NULL , 0 , send_msg_thread_2 , & info , 0 , & tid ) ;
2008-08-04 23:07:10 +02:00
WaitForSingleObject ( info . hevent [ EV_ACK ] , 10000 ) ;
2005-12-22 13:58:11 +01:00
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2005-12-22 13:58:11 +01:00
flush_sequence ( ) ;
SetLastError ( 0xdeadbeef ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
if ( GetLastError ( ) = = ERROR_INVALID_FLAGS )
{
trace ( " QS_RAWINPUT not supported on this platform \n " ) ;
qs_all_input & = ~ QS_RAWINPUT ;
qs_input & = ~ QS_RAWINPUT ;
}
2009-01-20 14:02:02 +01:00
if ( qstatus & QS_POSTMESSAGE )
{
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) /* nothing */ ;
qstatus = GetQueueStatus ( qs_all_input ) ;
}
2006-10-07 21:45:11 +02:00
ok ( qstatus = = 0 , " wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
trace ( " signalling to send message \n " ) ;
SetEvent ( info . hevent [ EV_SENDMSG ] ) ;
WaitForSingleObject ( info . hevent [ EV_ACK ] , INFINITE ) ;
/* pass invalid QS_xxxx flags */
SetLastError ( 0xdeadbeef ) ;
qstatus = GetQueueStatus ( 0xffffffff ) ;
2008-10-17 19:05:11 +02:00
ok ( qstatus = = 0 | | broken ( qstatus ) /* win9x */ , " GetQueueStatus should fail: %08x \n " , qstatus ) ;
if ( ! qstatus )
{
ok ( GetLastError ( ) = = ERROR_INVALID_FLAGS , " wrong error %d \n " , GetLastError ( ) ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
}
2009-03-06 10:38:39 +01:00
qstatus & = ~ MAKELONG ( 0x4000 , 0x4000 ) ; /* sometimes set on Win95 */
2005-12-22 13:58:11 +01:00
ok ( qstatus = = MAKELONG ( QS_SENDMESSAGE , QS_SENDMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ;
ok ( ! ret ,
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
msg . message ) ;
2005-12-22 17:15:54 +01:00
ok_sequence ( WmUser , " WmUser " , FALSE ) ;
2005-12-22 13:58:11 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
2006-10-07 21:45:11 +02:00
ok ( qstatus = = 0 , " wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
2009-02-17 14:57:57 +01:00
if ( ! ( qstatus & MAKELONG ( QS_KEY , QS_KEY ) ) )
{
skip ( " queuing key events not supported \n " ) ;
goto done ;
}
2009-12-16 12:28:41 +01:00
ok ( qstatus = = MAKELONG ( QS_KEY , QS_KEY ) | |
/* keybd_event seems to trigger a sent message on NT4 */
qstatus = = MAKELONG ( QS_KEY | QS_SENDMESSAGE , QS_KEY | QS_SENDMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
PostMessageA ( info . hwnd , WM_CHAR , ' z ' , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
2009-12-16 12:28:41 +01:00
ok ( qstatus = = MAKELONG ( QS_POSTMESSAGE , QS_POSTMESSAGE | QS_KEY ) | |
qstatus = = MAKELONG ( QS_POSTMESSAGE , QS_POSTMESSAGE | QS_KEY | QS_SENDMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
InvalidateRect ( info . hwnd , NULL , FALSE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
2009-12-16 12:28:41 +01:00
ok ( qstatus = = MAKELONG ( QS_PAINT , QS_PAINT | QS_POSTMESSAGE | QS_KEY ) | |
qstatus = = MAKELONG ( QS_PAINT , QS_PAINT | QS_POSTMESSAGE | QS_KEY | QS_SENDMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
trace ( " signalling to send message \n " ) ;
SetEvent ( info . hevent [ EV_SENDMSG ] ) ;
WaitForSingleObject ( info . hevent [ EV_ACK ] , INFINITE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_SENDMESSAGE , QS_SENDMESSAGE | QS_PAINT | QS_POSTMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | ( qs_input < < 16 ) ) ;
2008-10-17 19:05:11 +02:00
if ( ret & & msg . message = = WM_CHAR )
{
win_skip ( " PM_QS_* flags not supported in PeekMessage \n " ) ;
goto done ;
}
2006-06-01 18:40:14 +02:00
ok ( ! ret ,
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
msg . message ) ;
2008-11-11 23:27:34 +01:00
if ( ! sequence_cnt ) /* nt4 doesn't fetch anything with PM_QS_* flags */
2008-09-24 13:11:26 +02:00
{
2008-11-11 23:27:34 +01:00
win_skip ( " PM_QS_* flags not supported in PeekMessage \n " ) ;
goto done ;
2008-09-24 13:11:26 +02:00
}
2006-06-01 18:40:14 +02:00
ok_sequence ( WmUser , " WmUser " , FALSE ) ;
2005-12-22 13:58:11 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_PAINT | QS_POSTMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
trace ( " signalling to send message \n " ) ;
SetEvent ( info . hevent [ EV_SENDMSG ] ) ;
WaitForSingleObject ( info . hevent [ EV_ACK ] , INFINITE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_SENDMESSAGE , QS_SENDMESSAGE | QS_PAINT | QS_POSTMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
2008-11-11 23:27:34 +01:00
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | PM_QS_POSTMESSAGE ) ;
2006-06-01 18:40:14 +02:00
ok ( ! ret ,
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
msg . message ) ;
2005-12-22 13:58:11 +01:00
ok_sequence ( WmUser , " WmUser " , FALSE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_PAINT | QS_POSTMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | PM_QS_POSTMESSAGE ) ;
ok ( ret & & msg . message = = WM_CHAR & & msg . wParam = = ' z ' ,
2007-05-24 16:41:17 +02:00
" got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z' \n " ,
2006-06-01 18:40:14 +02:00
ret , msg . message , msg . wParam ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2005-12-22 13:58:11 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_PAINT | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | PM_QS_POSTMESSAGE ) ;
ok ( ! ret ,
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
msg . message ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_PAINT | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | PM_QS_PAINT ) ;
ok ( ret & & msg . message = = WM_PAINT ,
" got %d and %04x instead of TRUE and WM_PAINT \n " , ret , msg . message ) ;
DispatchMessageA ( & msg ) ;
ok_sequence ( WmPaint , " WmPaint " , FALSE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | PM_QS_PAINT ) ;
ok ( ! ret ,
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
msg . message ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2005-12-22 13:58:11 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
trace ( " signalling to send message \n " ) ;
SetEvent ( info . hevent [ EV_SENDMSG ] ) ;
WaitForSingleObject ( info . hevent [ EV_ACK ] , INFINITE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_SENDMESSAGE , QS_SENDMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
PostMessageA ( info . hwnd , WM_CHAR , ' z ' , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_POSTMESSAGE , QS_SENDMESSAGE | QS_POSTMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , WM_CHAR , WM_CHAR , PM_REMOVE ) ;
ok ( ret & & msg . message = = WM_CHAR & & msg . wParam = = ' z ' ,
2007-05-24 16:41:17 +02:00
" got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z' \n " ,
2006-06-01 18:40:14 +02:00
ret , msg . message , msg . wParam ) ;
ok_sequence ( WmUser , " WmUser " , FALSE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , WM_CHAR , WM_CHAR , PM_REMOVE ) ;
ok ( ! ret ,
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
msg . message ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2005-12-22 13:58:11 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
PostMessageA ( info . hwnd , WM_CHAR , ' z ' , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_POSTMESSAGE , QS_POSTMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
trace ( " signalling to send message \n " ) ;
SetEvent ( info . hevent [ EV_SENDMSG ] ) ;
WaitForSingleObject ( info . hevent [ EV_ACK ] , INFINITE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_SENDMESSAGE , QS_SENDMESSAGE | QS_POSTMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | ( QS_KEY < < 16 ) ) ;
ok ( ! ret ,
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
msg . message ) ;
ok_sequence ( WmUser , " WmUser " , FALSE ) ;
2005-12-22 13:58:11 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_POSTMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
2007-03-03 05:48:46 +01:00
if ( qs_all_input & QS_RAWINPUT ) /* use QS_RAWINPUT only if supported */
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | ( QS_RAWINPUT < < 16 ) ) ;
else /* workaround for a missing QS_RAWINPUT support */
ret = PeekMessageA ( & msg , 0 , WM_KEYDOWN , WM_KEYDOWN , PM_REMOVE ) ;
2006-06-01 18:40:14 +02:00
ok ( ret & & msg . message = = WM_KEYDOWN & & msg . wParam = = ' N ' ,
2007-05-24 16:41:17 +02:00
" got %d and %04x wParam %08lx instead of TRUE and WM_KEYDOWN wParam 'N' \n " ,
2006-06-01 18:40:14 +02:00
ret , msg . message , msg . wParam ) ;
2006-10-28 10:24:13 +02:00
ok_sequence ( WmKeyDownSkippedSeq , " WmKeyDownSkippedSeq " , FALSE ) ;
2006-06-01 18:40:14 +02:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_POSTMESSAGE | QS_KEY ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
2007-03-03 05:48:46 +01:00
if ( qs_all_input & QS_RAWINPUT ) /* use QS_RAWINPUT only if supported */
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | ( QS_RAWINPUT < < 16 ) ) ;
else /* workaround for a missing QS_RAWINPUT support */
ret = PeekMessageA ( & msg , 0 , WM_KEYUP , WM_KEYUP , PM_REMOVE ) ;
2006-06-01 18:40:14 +02:00
ok ( ret & & msg . message = = WM_KEYUP & & msg . wParam = = ' N ' ,
2007-05-24 16:41:17 +02:00
" got %d and %04x wParam %08lx instead of TRUE and WM_KEYUP wParam 'N' \n " ,
2006-06-01 18:40:14 +02:00
ret , msg . message , msg . wParam ) ;
2006-10-28 10:24:13 +02:00
ok_sequence ( WmKeyUpSkippedSeq , " WmKeyUpSkippedSeq " , FALSE ) ;
2005-12-22 13:58:11 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_POSTMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE | PM_QS_SENDMESSAGE ) ;
ok ( ! ret ,
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
msg . message ) ;
2005-12-22 13:58:11 +01:00
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_POSTMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ;
ok ( ret & & msg . message = = WM_CHAR & & msg . wParam = = ' z ' ,
2007-05-24 16:41:17 +02:00
" got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z' \n " ,
2006-06-01 18:40:14 +02:00
ret , msg . message , msg . wParam ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = 0 ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ;
ok ( ! ret ,
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
msg . message ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2005-12-22 13:58:11 +01:00
2006-05-24 08:53:24 +02:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = 0 ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-05-24 08:53:24 +02:00
/* test whether presence of the quit flag in the queue affects
* the queue state
*/
PostQuitMessage ( 0x1234abcd ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_POSTMESSAGE , QS_POSTMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-05-24 08:53:24 +02:00
PostMessageA ( info . hwnd , WM_USER , 0 , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_POSTMESSAGE , QS_POSTMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-05-24 08:53:24 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ;
ok ( ret & & msg . message = = WM_USER ,
2006-06-01 18:40:14 +02:00
" got %d and %04x instead of TRUE and WM_USER \n " , ret , msg . message ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2006-05-24 08:53:24 +02:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_POSTMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-05-24 08:53:24 +02:00
msg . message = 0 ;
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ;
ok ( ret & & msg . message = = WM_QUIT ,
2006-06-01 18:40:14 +02:00
" got %d and %04x instead of TRUE and WM_QUIT \n " , ret , msg . message ) ;
2007-05-24 16:41:17 +02:00
ok ( msg . wParam = = 0x1234abcd , " got wParam %08lx instead of 0x1234abcd \n " , msg . wParam ) ;
2006-06-01 18:40:14 +02:00
ok ( msg . lParam = = 0 , " got lParam %08lx instead of 0 \n " , msg . lParam ) ;
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2006-05-24 08:53:24 +02:00
qstatus = GetQueueStatus ( qs_all_input ) ;
todo_wine {
ok ( qstatus = = MAKELONG ( 0 , QS_POSTMESSAGE ) ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2006-05-24 08:53:24 +02:00
}
2006-06-01 18:40:14 +02:00
msg . message = 0 ;
2006-05-24 08:53:24 +02:00
ret = PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ;
ok ( ! ret ,
2006-06-01 18:40:14 +02:00
" PeekMessageA should have returned FALSE instead of msg %04x \n " ,
2006-05-24 08:53:24 +02:00
msg . message ) ;
2006-06-01 18:40:14 +02:00
ok_sequence ( WmEmptySeq , " WmEmptySeq " , FALSE ) ;
2006-05-24 08:53:24 +02:00
2005-12-22 13:58:11 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = 0 ,
2006-10-07 21:45:11 +02:00
" wrong qstatus %08x \n " , qstatus ) ;
2005-12-22 13:58:11 +01:00
2008-10-29 12:13:57 +01:00
/* some GetMessage tests */
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_KEY , QS_KEY ) , " wrong qstatus %08x \n " , qstatus ) ;
PostMessageA ( info . hwnd , WM_CHAR , ' z ' , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_POSTMESSAGE , QS_POSTMESSAGE | QS_KEY ) , " wrong qstatus %08x \n " , qstatus ) ;
2008-11-12 12:36:22 +01:00
if ( qstatus )
{
ret = GetMessageA ( & msg , 0 , 0 , 0 ) ;
ok ( ret & & msg . message = = WM_CHAR & & msg . wParam = = ' z ' ,
" got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z' \n " ,
ret , msg . message , msg . wParam ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_KEY ) , " wrong qstatus %08x \n " , qstatus ) ;
}
2008-10-29 12:13:57 +01:00
2008-11-12 12:36:22 +01:00
if ( qstatus )
{
ret = GetMessageA ( & msg , 0 , 0 , 0 ) ;
ok ( ret & & msg . message = = WM_KEYDOWN & & msg . wParam = = ' N ' ,
" got %d and %04x wParam %08lx instead of TRUE and WM_KEYDOWN wParam 'N' \n " ,
ret , msg . message , msg . wParam ) ;
2009-01-12 18:03:14 +01:00
ok_sequence ( WmKeyDownSkippedSeq , " WmKeyDownSkippedSeq " , FALSE ) ;
2008-11-12 12:36:22 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = 0 , " wrong qstatus %08x \n " , qstatus ) ;
}
2008-10-29 12:13:57 +01:00
keybd_event ( ' N ' , 0 , 0 , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_KEY , QS_KEY ) , " wrong qstatus %08x \n " , qstatus ) ;
PostMessageA ( info . hwnd , WM_CHAR , ' z ' , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_POSTMESSAGE , QS_POSTMESSAGE | QS_KEY ) , " wrong qstatus %08x \n " , qstatus ) ;
2008-11-12 12:36:22 +01:00
if ( qstatus & ( QS_KEY < < 16 ) )
{
ret = GetMessageA ( & msg , 0 , WM_KEYDOWN , WM_KEYUP ) ;
ok ( ret & & msg . message = = WM_KEYDOWN & & msg . wParam = = ' N ' ,
" got %d and %04x wParam %08lx instead of TRUE and WM_KEYDOWN wParam 'N' \n " ,
ret , msg . message , msg . wParam ) ;
2009-01-12 18:03:14 +01:00
ok_sequence ( WmKeyDownWasDownSkippedSeq , " WmKeyDownWasDownSkippedSeq " , FALSE ) ;
2008-11-12 12:36:22 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_POSTMESSAGE ) , " wrong qstatus %08x \n " , qstatus ) ;
}
2008-10-29 12:13:57 +01:00
2008-11-12 12:36:22 +01:00
if ( qstatus )
{
ret = GetMessageA ( & msg , 0 , WM_CHAR , WM_CHAR ) ;
ok ( ret & & msg . message = = WM_CHAR & & msg . wParam = = ' z ' ,
" got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z' \n " ,
ret , msg . message , msg . wParam ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = 0 , " wrong qstatus %08x \n " , qstatus ) ;
}
2008-10-29 12:13:57 +01:00
keybd_event ( ' N ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_KEY , QS_KEY ) , " wrong qstatus %08x \n " , qstatus ) ;
PostMessageA ( info . hwnd , WM_CHAR , ' z ' , 0 ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_POSTMESSAGE , QS_POSTMESSAGE | QS_KEY ) , " wrong qstatus %08x \n " , qstatus ) ;
trace ( " signalling to send message \n " ) ;
SetEvent ( info . hevent [ EV_SENDMSG ] ) ;
WaitForSingleObject ( info . hevent [ EV_ACK ] , INFINITE ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( QS_SENDMESSAGE , QS_SENDMESSAGE | QS_POSTMESSAGE | QS_KEY ) ,
" wrong qstatus %08x \n " , qstatus ) ;
2008-11-12 12:36:22 +01:00
if ( qstatus & ( QS_KEY < < 16 ) )
{
ret = GetMessageA ( & msg , 0 , WM_KEYDOWN , WM_KEYUP ) ;
ok ( ret & & msg . message = = WM_KEYUP & & msg . wParam = = ' N ' ,
" got %d and %04x wParam %08lx instead of TRUE and WM_KEYDOWN wParam 'N' \n " ,
ret , msg . message , msg . wParam ) ;
2009-01-12 18:03:14 +01:00
ok_sequence ( WmUserKeyUpSkippedSeq , " WmUserKeyUpSkippedSeq " , FALSE ) ;
2008-11-12 12:36:22 +01:00
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = MAKELONG ( 0 , QS_POSTMESSAGE ) , " wrong qstatus %08x \n " , qstatus ) ;
}
2008-10-29 12:13:57 +01:00
2008-11-12 12:36:22 +01:00
if ( qstatus )
{
ret = GetMessageA ( & msg , 0 , WM_CHAR , WM_CHAR ) ;
ok ( ret & & msg . message = = WM_CHAR & & msg . wParam = = ' z ' ,
" got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z' \n " ,
ret , msg . message , msg . wParam ) ;
qstatus = GetQueueStatus ( qs_all_input ) ;
ok ( qstatus = = 0 , " wrong qstatus %08x \n " , qstatus ) ;
}
2008-10-17 19:05:11 +02:00
done :
2005-12-22 13:58:11 +01:00
trace ( " signalling to exit \n " ) ;
2008-08-04 23:07:10 +02:00
SetEvent ( info . hevent [ EV_STOP ] ) ;
2005-12-22 13:58:11 +01:00
WaitForSingleObject ( hthread , INFINITE ) ;
CloseHandle ( hthread ) ;
CloseHandle ( info . hevent [ 0 ] ) ;
CloseHandle ( info . hevent [ 1 ] ) ;
CloseHandle ( info . hevent [ 2 ] ) ;
DestroyWindow ( info . hwnd ) ;
}
2007-10-04 21:51:37 +02:00
static void wait_move_event ( HWND hwnd , int x , int y )
{
MSG msg ;
DWORD time ;
BOOL ret ;
int go = 0 ;
time = GetTickCount ( ) ;
while ( GetTickCount ( ) - time < 200 & & ! go ) {
ret = PeekMessageA ( & msg , hwnd , WM_MOUSEMOVE , WM_MOUSEMOVE , PM_NOREMOVE ) ;
go = ret & & msg . pt . x > x & & msg . pt . y > y ;
2009-02-12 17:52:54 +01:00
if ( ! ret ) MsgWaitForMultipleObjects ( 0 , NULL , FALSE , GetTickCount ( ) - time , QS_ALLINPUT ) ;
2007-10-04 21:51:37 +02:00
}
}
2009-02-11 14:21:51 +01:00
# define STEP 5
2007-10-04 21:51:37 +02:00
static void test_PeekMessage2 ( void )
{
HWND hwnd ;
BOOL ret ;
MSG msg ;
UINT message ;
DWORD time1 , time2 , time3 ;
int x1 , y1 , x2 , y2 , x3 , y3 ;
POINT pos ;
time1 = time2 = time3 = 0 ;
x1 = y1 = x2 = y2 = x3 = y3 = 0 ;
/* Initialise window and make sure it is ready for events */
hwnd = CreateWindow ( " TestWindowClass " , " PeekMessage2 " , WS_OVERLAPPEDWINDOW ,
10 , 10 , 800 , 800 , NULL , NULL , NULL , NULL ) ;
assert ( hwnd ) ;
trace ( " Window for test_PeekMessage2 %p \n " , hwnd ) ;
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
SetFocus ( hwnd ) ;
GetCursorPos ( & pos ) ;
SetCursorPos ( 100 , 100 ) ;
mouse_event ( MOUSEEVENTF_MOVE , - STEP , - STEP , 0 , 0 ) ;
flush_events ( ) ;
/* Do initial mousemove, wait until we can see it
and then do our test peek with PM_NOREMOVE . */
mouse_event ( MOUSEEVENTF_MOVE , STEP , STEP , 0 , 0 ) ;
2009-02-11 14:21:51 +01:00
wait_move_event ( hwnd , 100 - STEP , 100 - STEP ) ;
2007-10-04 21:51:37 +02:00
ret = PeekMessageA ( & msg , hwnd , WM_MOUSEMOVE , WM_MOUSEMOVE , PM_NOREMOVE ) ;
2009-02-20 16:56:16 +01:00
if ( ! ret )
{
skip ( " queuing mouse events not supported \n " ) ;
goto done ;
}
else
{
2007-10-04 21:51:37 +02:00
trace ( " 1st move event: %04x %x %d %d \n " , msg . message , msg . time , msg . pt . x , msg . pt . y ) ;
message = msg . message ;
time1 = msg . time ;
x1 = msg . pt . x ;
y1 = msg . pt . y ;
ok ( message = = WM_MOUSEMOVE , " message not WM_MOUSEMOVE, %04x instead \n " , message ) ;
}
/* Allow time to advance a bit, and then simulate the user moving their
* mouse around . After that we peek again with PM_NOREMOVE .
* Although the previous mousemove message was never removed , the
* mousemove we now peek should reflect the recent mouse movements
* because the input queue will merge the move events . */
2009-02-11 14:21:51 +01:00
Sleep ( 100 ) ;
2007-10-04 21:51:37 +02:00
mouse_event ( MOUSEEVENTF_MOVE , STEP , STEP , 0 , 0 ) ;
wait_move_event ( hwnd , x1 , y1 ) ;
ret = PeekMessageA ( & msg , hwnd , WM_MOUSEMOVE , WM_MOUSEMOVE , PM_NOREMOVE ) ;
ok ( ret , " no message available \n " ) ;
if ( ret ) {
trace ( " 2nd move event: %04x %x %d %d \n " , msg . message , msg . time , msg . pt . x , msg . pt . y ) ;
message = msg . message ;
time2 = msg . time ;
x2 = msg . pt . x ;
y2 = msg . pt . y ;
ok ( message = = WM_MOUSEMOVE , " message not WM_MOUSEMOVE, %04x instead \n " , message ) ;
ok ( time2 > time1 , " message time not advanced: %x %x \n " , time1 , time2 ) ;
ok ( x2 ! = x1 & & y2 ! = y1 , " coords not changed: (%d %d) (%d %d) \n " , x1 , y1 , x2 , y2 ) ;
}
/* Have another go, to drive the point home */
2009-02-11 14:21:51 +01:00
Sleep ( 100 ) ;
2007-10-04 21:51:37 +02:00
mouse_event ( MOUSEEVENTF_MOVE , STEP , STEP , 0 , 0 ) ;
wait_move_event ( hwnd , x2 , y2 ) ;
ret = PeekMessageA ( & msg , hwnd , WM_MOUSEMOVE , WM_MOUSEMOVE , PM_NOREMOVE ) ;
ok ( ret , " no message available \n " ) ;
if ( ret ) {
trace ( " 3rd move event: %04x %x %d %d \n " , msg . message , msg . time , msg . pt . x , msg . pt . y ) ;
message = msg . message ;
time3 = msg . time ;
x3 = msg . pt . x ;
y3 = msg . pt . y ;
ok ( message = = WM_MOUSEMOVE , " message not WM_MOUSEMOVE, %04x instead \n " , message ) ;
ok ( time3 > time2 , " message time not advanced: %x %x \n " , time2 , time3 ) ;
ok ( x3 ! = x2 & & y3 ! = y2 , " coords not changed: (%d %d) (%d %d) \n " , x2 , y2 , x3 , y3 ) ;
}
2009-02-20 16:56:16 +01:00
done :
2007-10-04 21:51:37 +02:00
DestroyWindow ( hwnd ) ;
SetCursorPos ( pos . x , pos . y ) ;
flush_events ( ) ;
}
2005-12-22 13:58:11 +01:00
2006-01-17 13:14:31 +01:00
static void test_quit_message ( void )
{
MSG msg ;
BOOL ret ;
/* test using PostQuitMessage */
2008-07-31 17:16:22 +02:00
flush_events ( ) ;
2006-01-17 13:14:31 +01:00
PostQuitMessage ( 0xbeef ) ;
ret = PeekMessage ( & msg , NULL , 0 , 0 , PM_NOREMOVE ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " PeekMessage failed with error %d \n " , GetLastError ( ) ) ;
2006-01-17 13:14:31 +01:00
ok ( msg . message = = WM_QUIT , " Received message 0x%04x instead of WM_QUIT \n " , msg . message ) ;
2007-05-24 16:41:17 +02:00
ok ( msg . wParam = = 0xbeef , " wParam was 0x%lx instead of 0xbeef \n " , msg . wParam ) ;
2006-01-17 13:14:31 +01:00
ret = PostThreadMessage ( GetCurrentThreadId ( ) , WM_USER , 0 , 0 ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " PostMessage failed with error %d \n " , GetLastError ( ) ) ;
2006-01-17 13:14:31 +01:00
ret = GetMessage ( & msg , NULL , 0 , 0 ) ;
2006-10-07 21:45:11 +02:00
ok ( ret > 0 , " GetMessage failed with error %d \n " , GetLastError ( ) ) ;
2006-01-17 13:14:31 +01:00
ok ( msg . message = = WM_USER , " Received message 0x%04x instead of WM_USER \n " , msg . message ) ;
/* note: WM_QUIT message received after WM_USER message */
ret = GetMessage ( & msg , NULL , 0 , 0 ) ;
2006-10-07 21:45:11 +02:00
ok ( ! ret , " GetMessage return %d with error %d instead of FALSE \n " , ret , GetLastError ( ) ) ;
2006-01-17 13:14:31 +01:00
ok ( msg . message = = WM_QUIT , " Received message 0x%04x instead of WM_QUIT \n " , msg . message ) ;
2007-05-24 16:41:17 +02:00
ok ( msg . wParam = = 0xbeef , " wParam was 0x%lx instead of 0xbeef \n " , msg . wParam ) ;
2006-01-17 13:14:31 +01:00
ret = PeekMessage ( & msg , NULL , 0 , 0 , PM_REMOVE ) ;
ok ( ! ret | | msg . message ! = WM_QUIT , " Received WM_QUIT again \n " ) ;
/* now test with PostThreadMessage - different behaviour! */
PostThreadMessage ( GetCurrentThreadId ( ) , WM_QUIT , 0xdead , 0 ) ;
ret = PeekMessage ( & msg , NULL , 0 , 0 , PM_NOREMOVE ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " PeekMessage failed with error %d \n " , GetLastError ( ) ) ;
2006-01-17 13:14:31 +01:00
ok ( msg . message = = WM_QUIT , " Received message 0x%04x instead of WM_QUIT \n " , msg . message ) ;
2007-05-24 16:41:17 +02:00
ok ( msg . wParam = = 0xdead , " wParam was 0x%lx instead of 0xdead \n " , msg . wParam ) ;
2006-01-17 13:14:31 +01:00
ret = PostThreadMessage ( GetCurrentThreadId ( ) , WM_USER , 0 , 0 ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " PostMessage failed with error %d \n " , GetLastError ( ) ) ;
2006-01-17 13:14:31 +01:00
/* note: we receive the WM_QUIT message first this time */
ret = GetMessage ( & msg , NULL , 0 , 0 ) ;
2006-10-07 21:45:11 +02:00
ok ( ! ret , " GetMessage return %d with error %d instead of FALSE \n " , ret , GetLastError ( ) ) ;
2006-01-17 13:14:31 +01:00
ok ( msg . message = = WM_QUIT , " Received message 0x%04x instead of WM_QUIT \n " , msg . message ) ;
2007-05-24 16:41:17 +02:00
ok ( msg . wParam = = 0xdead , " wParam was 0x%lx instead of 0xdead \n " , msg . wParam ) ;
2006-01-17 13:14:31 +01:00
ret = GetMessage ( & msg , NULL , 0 , 0 ) ;
2006-10-07 21:45:11 +02:00
ok ( ret > 0 , " GetMessage failed with error %d \n " , GetLastError ( ) ) ;
2006-01-17 13:14:31 +01:00
ok ( msg . message = = WM_USER , " Received message 0x%04x instead of WM_USER \n " , msg . message ) ;
}
2006-07-20 15:27:29 +02:00
static const struct message WmMouseHoverSeq [ ] = {
2007-08-20 22:03:06 +02:00
{ WM_MOUSEACTIVATE , sent | optional } , /* we can get those when moving the mouse in focus-follow-mouse mode under X11 */
{ WM_MOUSEACTIVATE , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_TIMER , sent | optional } , /* XP sends it */
2006-07-20 15:27:29 +02:00
{ WM_SYSTIMER , sent } ,
{ WM_MOUSEHOVER , sent | wparam , 0 } ,
{ 0 }
} ;
2006-07-24 17:45:30 +02:00
static void pump_msg_loop_timeout ( DWORD timeout , BOOL inject_mouse_move )
{
MSG msg ;
DWORD start_ticks , end_ticks ;
start_ticks = GetTickCount ( ) ;
2008-09-19 12:07:18 +02:00
/* add some deviation (50%) to cover not expected delays */
start_ticks + = timeout / 2 ;
2006-07-24 17:45:30 +02:00
do
{
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) )
{
/* Timer proc messages are not dispatched to the window proc,
* and therefore not logged .
*/
2009-12-16 12:28:41 +01:00
if ( ( msg . message = = WM_TIMER | | msg . message = = WM_SYSTIMER ) & & msg . hwnd )
2006-07-24 17:45:30 +02:00
{
2009-01-12 21:03:57 +01:00
struct recvd_message s_msg ;
2006-07-24 17:45:30 +02:00
2009-01-12 21:03:57 +01:00
s_msg . hwnd = msg . hwnd ;
2006-07-24 17:45:30 +02:00
s_msg . message = msg . message ;
s_msg . flags = sent | wparam | lparam ;
s_msg . wParam = msg . wParam ;
s_msg . lParam = msg . lParam ;
2009-01-12 21:03:57 +01:00
s_msg . descr = " msg_loop " ;
2006-07-24 17:45:30 +02:00
add_message ( & s_msg ) ;
}
DispatchMessage ( & msg ) ;
}
end_ticks = GetTickCount ( ) ;
/* inject WM_MOUSEMOVE to see how it changes tracking */
if ( inject_mouse_move & & start_ticks + timeout / 2 > = end_ticks )
{
mouse_event ( MOUSEEVENTF_MOVE , - 1 , 0 , 0 , 0 ) ;
mouse_event ( MOUSEEVENTF_MOVE , 1 , 0 , 0 , 0 ) ;
inject_mouse_move = FALSE ;
}
} while ( start_ticks + timeout > = end_ticks ) ;
}
2006-07-20 15:27:29 +02:00
static void test_TrackMouseEvent ( void )
{
TRACKMOUSEEVENT tme ;
BOOL ret ;
HWND hwnd , hchild ;
RECT rc_parent , rc_child ;
2006-07-24 17:45:30 +02:00
UINT default_hover_time , hover_width = 0 , hover_height = 0 ;
2006-07-20 15:27:29 +02:00
# define track_hover(track_hwnd, track_hover_time) \
tme . cbSize = sizeof ( tme ) ; \
tme . dwFlags = TME_HOVER ; \
tme . hwndTrack = track_hwnd ; \
tme . dwHoverTime = track_hover_time ; \
SetLastError ( 0xdeadbeef ) ; \
2007-08-15 14:23:45 +02:00
ret = pTrackMouseEvent ( & tme ) ; \
2006-10-07 21:45:11 +02:00
ok ( ret , " TrackMouseEvent(TME_HOVER) error %d \n " , GetLastError ( ) )
2006-07-20 15:27:29 +02:00
# define track_query(expected_track_flags, expected_track_hwnd, expected_hover_time) \
tme . cbSize = sizeof ( tme ) ; \
tme . dwFlags = TME_QUERY ; \
tme . hwndTrack = ( HWND ) 0xdeadbeef ; \
tme . dwHoverTime = 0xdeadbeef ; \
SetLastError ( 0xdeadbeef ) ; \
2007-08-15 14:23:45 +02:00
ret = pTrackMouseEvent ( & tme ) ; \
2006-10-07 21:45:11 +02:00
ok ( ret , " TrackMouseEvent(TME_QUERY) error %d \n " , GetLastError ( ) ) ; \
ok ( tme . cbSize = = sizeof ( tme ) , " wrong tme.cbSize %u \n " , tme . cbSize ) ; \
2006-07-20 15:27:29 +02:00
ok ( tme . dwFlags = = ( expected_track_flags ) , \
2006-10-07 21:45:11 +02:00
" wrong tme.dwFlags %08x, expected %08x \n " , tme . dwFlags , ( expected_track_flags ) ) ; \
2006-07-20 15:27:29 +02:00
ok ( tme . hwndTrack = = ( expected_track_hwnd ) , \
" wrong tme.hwndTrack %p, expected %p \n " , tme . hwndTrack , ( expected_track_hwnd ) ) ; \
ok ( tme . dwHoverTime = = ( expected_hover_time ) , \
2006-10-07 21:45:11 +02:00
" wrong tme.dwHoverTime %u, expected %u \n " , tme . dwHoverTime , ( expected_hover_time ) )
2006-07-20 15:27:29 +02:00
# define track_hover_cancel(track_hwnd) \
tme . cbSize = sizeof ( tme ) ; \
tme . dwFlags = TME_HOVER | TME_CANCEL ; \
tme . hwndTrack = track_hwnd ; \
tme . dwHoverTime = 0xdeadbeef ; \
SetLastError ( 0xdeadbeef ) ; \
2007-08-15 14:23:45 +02:00
ret = pTrackMouseEvent ( & tme ) ; \
2006-10-07 21:45:11 +02:00
ok ( ret , " TrackMouseEvent(TME_HOVER | TME_CANCEL) error %d \n " , GetLastError ( ) )
2006-07-20 15:27:29 +02:00
default_hover_time = 0xdeadbeef ;
2007-01-09 00:39:49 +01:00
SetLastError ( 0xdeadbeef ) ;
2006-07-20 15:27:29 +02:00
ret = SystemParametersInfo ( SPI_GETMOUSEHOVERTIME , 0 , & default_hover_time , 0 ) ;
2008-09-22 12:14:56 +02:00
ok ( ret | | broken ( GetLastError ( ) = = 0xdeadbeef ) , /* win9x */
" SystemParametersInfo(SPI_GETMOUSEHOVERTIME) error %u \n " , GetLastError ( ) ) ;
2007-01-07 12:40:46 +01:00
if ( ! ret ) default_hover_time = 400 ;
2006-07-20 15:27:29 +02:00
trace ( " SPI_GETMOUSEHOVERTIME returned %u ms \n " , default_hover_time ) ;
2007-01-09 00:39:49 +01:00
SetLastError ( 0xdeadbeef ) ;
2007-01-07 12:40:46 +01:00
ret = SystemParametersInfo ( SPI_GETMOUSEHOVERWIDTH , 0 , & hover_width , 0 ) ;
2008-09-22 12:14:56 +02:00
ok ( ret | | broken ( GetLastError ( ) = = 0xdeadbeef ) , /* win9x */
" SystemParametersInfo(SPI_GETMOUSEHOVERWIDTH) error %u \n " , GetLastError ( ) ) ;
2007-01-07 12:40:46 +01:00
if ( ! ret ) hover_width = 4 ;
2007-01-09 00:39:49 +01:00
SetLastError ( 0xdeadbeef ) ;
2007-01-07 12:40:46 +01:00
ret = SystemParametersInfo ( SPI_GETMOUSEHOVERHEIGHT , 0 , & hover_height , 0 ) ;
2008-09-22 12:14:56 +02:00
ok ( ret | | broken ( GetLastError ( ) = = 0xdeadbeef ) , /* win9x */
" SystemParametersInfo(SPI_GETMOUSEHOVERHEIGHT) error %u \n " , GetLastError ( ) ) ;
2007-01-07 12:40:46 +01:00
if ( ! ret ) hover_height = 4 ;
2006-07-24 17:45:30 +02:00
trace ( " hover rect is %u x %d \n " , hover_width , hover_height ) ;
2006-07-20 15:27:29 +02:00
hwnd = CreateWindowEx ( 0 , " TestWindowClass " , NULL ,
WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
CW_USEDEFAULT , CW_USEDEFAULT , 300 , 300 , 0 ,
NULL , NULL , 0 ) ;
assert ( hwnd ) ;
hchild = CreateWindowEx ( 0 , " TestWindowClass " , NULL ,
WS_CHILD | WS_BORDER | WS_VISIBLE ,
50 , 50 , 200 , 200 , hwnd ,
NULL , NULL , 0 ) ;
assert ( hchild ) ;
2008-09-16 16:27:47 +02:00
SetWindowPos ( hwnd , HWND_TOPMOST , 0 , 0 , 0 , 0 , SWP_NOSIZE | SWP_NOMOVE ) ;
2006-07-20 15:27:29 +02:00
flush_events ( ) ;
flush_sequence ( ) ;
tme . cbSize = 0 ;
tme . dwFlags = TME_QUERY ;
tme . hwndTrack = ( HWND ) 0xdeadbeef ;
tme . dwHoverTime = 0xdeadbeef ;
SetLastError ( 0xdeadbeef ) ;
2007-08-15 14:23:45 +02:00
ret = pTrackMouseEvent ( & tme ) ;
2006-07-20 15:27:29 +02:00
ok ( ! ret , " TrackMouseEvent should fail \n " ) ;
2008-08-04 23:07:10 +02:00
ok ( GetLastError ( ) = = ERROR_INVALID_PARAMETER | | broken ( GetLastError ( ) = = 0xdeadbeef ) ,
" not expected error %u \n " , GetLastError ( ) ) ;
2006-07-20 15:27:29 +02:00
tme . cbSize = sizeof ( tme ) ;
tme . dwFlags = TME_HOVER ;
tme . hwndTrack = ( HWND ) 0xdeadbeef ;
tme . dwHoverTime = 0xdeadbeef ;
SetLastError ( 0xdeadbeef ) ;
2007-08-15 14:23:45 +02:00
ret = pTrackMouseEvent ( & tme ) ;
2006-07-20 15:27:29 +02:00
ok ( ! ret , " TrackMouseEvent should fail \n " ) ;
2008-08-04 23:07:10 +02:00
ok ( GetLastError ( ) = = ERROR_INVALID_WINDOW_HANDLE | | broken ( GetLastError ( ) = = 0xdeadbeef ) ,
" not expected error %u \n " , GetLastError ( ) ) ;
2006-07-20 15:27:29 +02:00
tme . cbSize = sizeof ( tme ) ;
tme . dwFlags = TME_HOVER | TME_CANCEL ;
tme . hwndTrack = ( HWND ) 0xdeadbeef ;
tme . dwHoverTime = 0xdeadbeef ;
SetLastError ( 0xdeadbeef ) ;
2007-08-15 14:23:45 +02:00
ret = pTrackMouseEvent ( & tme ) ;
2006-07-20 15:27:29 +02:00
ok ( ! ret , " TrackMouseEvent should fail \n " ) ;
2008-08-04 23:07:10 +02:00
ok ( GetLastError ( ) = = ERROR_INVALID_WINDOW_HANDLE | | broken ( GetLastError ( ) = = 0xdeadbeef ) ,
" not expected error %u \n " , GetLastError ( ) ) ;
2006-07-20 15:27:29 +02:00
GetWindowRect ( hwnd , & rc_parent ) ;
GetWindowRect ( hchild , & rc_child ) ;
SetCursorPos ( rc_child . left - 10 , rc_child . top - 10 ) ;
/* Process messages so that the system updates its internal current
* window and hittest , otherwise TrackMouseEvent calls don ' t have any
* effect .
*/
2007-07-11 14:40:19 +02:00
flush_events ( ) ;
2006-07-20 15:27:29 +02:00
flush_sequence ( ) ;
track_query ( 0 , NULL , 0 ) ;
track_hover ( hchild , 0 ) ;
track_query ( 0 , NULL , 0 ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2006-07-20 15:27:29 +02:00
flush_sequence ( ) ;
track_hover ( hwnd , 0 ) ;
2009-01-22 13:11:38 +01:00
tme . cbSize = sizeof ( tme ) ;
tme . dwFlags = TME_QUERY ;
tme . hwndTrack = ( HWND ) 0xdeadbeef ;
tme . dwHoverTime = 0xdeadbeef ;
SetLastError ( 0xdeadbeef ) ;
ret = pTrackMouseEvent ( & tme ) ;
ok ( ret , " TrackMouseEvent(TME_QUERY) error %d \n " , GetLastError ( ) ) ;
ok ( tme . cbSize = = sizeof ( tme ) , " wrong tme.cbSize %u \n " , tme . cbSize ) ;
if ( ! tme . dwFlags )
{
skip ( " Cursor not inside window, skipping TrackMouseEvent tests \n " ) ;
DestroyWindow ( hwnd ) ;
return ;
}
ok ( tme . dwFlags = = TME_HOVER , " wrong tme.dwFlags %08x, expected TME_HOVER \n " , tme . dwFlags ) ;
ok ( tme . hwndTrack = = hwnd , " wrong tme.hwndTrack %p, expected %p \n " , tme . hwndTrack , hwnd ) ;
ok ( tme . dwHoverTime = = default_hover_time , " wrong tme.dwHoverTime %u, expected %u \n " ,
tme . dwHoverTime , default_hover_time ) ;
2006-07-20 15:27:29 +02:00
2006-07-24 17:45:30 +02:00
pump_msg_loop_timeout ( default_hover_time , FALSE ) ;
ok_sequence ( WmMouseHoverSeq , " WmMouseHoverSeq " , FALSE ) ;
2006-07-20 15:27:29 +02:00
2006-07-24 17:45:30 +02:00
track_query ( 0 , NULL , 0 ) ;
track_hover ( hwnd , HOVER_DEFAULT ) ;
track_query ( TME_HOVER , hwnd , default_hover_time ) ;
Sleep ( default_hover_time / 2 ) ;
mouse_event ( MOUSEEVENTF_MOVE , - 1 , 0 , 0 , 0 ) ;
mouse_event ( MOUSEEVENTF_MOVE , 1 , 0 , 0 , 0 ) ;
track_query ( TME_HOVER , hwnd , default_hover_time ) ;
2009-01-25 17:29:05 +01:00
pump_msg_loop_timeout ( default_hover_time , FALSE ) ;
2006-07-20 15:27:29 +02:00
ok_sequence ( WmMouseHoverSeq , " WmMouseHoverSeq " , FALSE ) ;
track_query ( 0 , NULL , 0 ) ;
2006-07-24 17:45:30 +02:00
track_hover ( hwnd , HOVER_DEFAULT ) ;
track_query ( TME_HOVER , hwnd , default_hover_time ) ;
pump_msg_loop_timeout ( default_hover_time , TRUE ) ;
ok_sequence ( WmMouseHoverSeq , " WmMouseHoverSeq " , FALSE ) ;
track_query ( 0 , NULL , 0 ) ;
2006-07-20 15:27:29 +02:00
track_hover ( hwnd , HOVER_DEFAULT ) ;
track_query ( TME_HOVER , hwnd , default_hover_time ) ;
track_hover_cancel ( hwnd ) ;
DestroyWindow ( hwnd ) ;
# undef track_hover
# undef track_query
# undef track_hover_cancel
}
2006-10-30 17:43:38 +01:00
static const struct message WmSetWindowRgn [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE } ,
2006-10-30 17:43:38 +01:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2008-07-31 17:16:22 +02:00
{ WM_NCPAINT , sent | optional } , /* wparam != 1 */
2006-10-30 17:43:38 +01:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2008-07-31 17:16:22 +02:00
{ WM_ERASEBKGND , sent | optional } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE } ,
2006-10-30 17:43:38 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmSetWindowRgn_no_redraw [ ] = {
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW } ,
2006-10-30 17:43:38 +01:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW } ,
2006-10-30 17:43:38 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message WmSetWindowRgn_clear [ ] = {
2008-07-31 17:16:22 +02:00
{ WM_WINDOWPOSCHANGING , sent /*|wparam*/ , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE /*|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE only on some Windows versions */ } ,
2006-10-30 17:43:38 +01:00
{ WM_NCCALCSIZE , sent | wparam , 1 } ,
2008-08-04 23:07:10 +02:00
{ WM_NCPAINT , sent | optional } ,
2006-10-30 17:43:38 +01:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } , /* FIXME: remove optional once Wine is fixed */
2007-01-07 12:40:46 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE } ,
2006-10-30 17:43:38 +01:00
{ WM_NCCALCSIZE , sent | wparam | optional , 1 } ,
2008-08-04 23:07:10 +02:00
{ WM_NCPAINT , sent | optional } ,
2006-10-30 17:43:38 +01:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2008-07-31 17:16:22 +02:00
{ WM_WINDOWPOSCHANGING , sent | optional } ,
{ WM_NCCALCSIZE , sent | optional | wparam , 1 } ,
2008-08-04 23:07:10 +02:00
{ WM_NCPAINT , sent | optional } ,
2008-07-31 17:16:22 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
{ WM_WINDOWPOSCHANGED , sent | optional | wparam , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE } ,
2008-08-04 23:07:10 +02:00
{ WM_NCCALCSIZE , sent | optional | wparam , 1 } ,
{ WM_NCPAINT , sent | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2006-10-30 17:43:38 +01:00
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static void test_SetWindowRgn ( void )
{
HRGN hrgn ;
HWND hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test overlapped " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
ShowWindow ( hwnd , SW_SHOW ) ;
UpdateWindow ( hwnd ) ;
flush_events ( ) ;
flush_sequence ( ) ;
trace ( " testing SetWindowRgn \n " ) ;
hrgn = CreateRectRgn ( 0 , 0 , 150 , 150 ) ;
SetWindowRgn ( hwnd , hrgn , TRUE ) ;
ok_sequence ( WmSetWindowRgn , " WmSetWindowRgn " , FALSE ) ;
hrgn = CreateRectRgn ( 30 , 30 , 160 , 160 ) ;
SetWindowRgn ( hwnd , hrgn , FALSE ) ;
ok_sequence ( WmSetWindowRgn_no_redraw , " WmSetWindowRgn_no_redraw " , FALSE ) ;
hrgn = CreateRectRgn ( 0 , 0 , 180 , 180 ) ;
SetWindowRgn ( hwnd , hrgn , TRUE ) ;
ok_sequence ( WmSetWindowRgn , " WmSetWindowRgn2 " , FALSE ) ;
SetWindowRgn ( hwnd , 0 , TRUE ) ;
ok_sequence ( WmSetWindowRgn_clear , " WmSetWindowRgn_clear " , FALSE ) ;
DestroyWindow ( hwnd ) ;
}
2006-12-22 11:32:04 +01:00
/*************************** ShowWindow() test ******************************/
static const struct message WmShowNormal [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
{ HCBT_ACTIVATE , hook } ,
2007-01-04 15:09:20 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* win2003 doesn't send it */
2006-12-22 11:32:04 +01:00
{ HCBT_SETFOCUS , hook } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
{ 0 }
} ;
static const struct message WmShow [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2006-12-30 15:03:03 +01:00
{ HCBT_ACTIVATE , hook | optional } , /* win2000 doesn't send it */
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* win2000 doesn't send it */
{ HCBT_SETFOCUS , hook | optional } , /* win2000 doesn't send it */
2006-12-22 11:32:04 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
{ 0 }
} ;
static const struct message WmShowNoActivate_1 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWNOACTIVATE } ,
2009-01-15 15:43:58 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_MOVE , sent | defwinproc | optional } ,
2006-12-22 11:32:04 +01:00
{ WM_SIZE , sent | wparam | defwinproc , SIZE_RESTORED } ,
{ 0 }
} ;
static const struct message WmShowNoActivate_2 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWNOACTIVATE } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | defwinproc } ,
{ WM_SIZE , sent | wparam | defwinproc , SIZE_RESTORED } ,
2008-03-04 20:00:13 +01:00
{ HCBT_SETFOCUS , hook | optional } ,
2007-01-04 15:09:20 +01:00
{ HCBT_ACTIVATE , hook | optional } , /* win2003 doesn't send it */
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* win2003 doesn't send it */
2009-03-03 13:20:49 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2007-01-04 15:09:20 +01:00
{ HCBT_SETFOCUS , hook | optional } , /* win2003 doesn't send it */
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmShowNA_1 [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
{ 0 }
} ;
static const struct message WmShowNA_2 [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE } ,
2009-01-19 12:36:11 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmRestore_1 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_RESTORE } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-30 15:03:03 +01:00
{ HCBT_ACTIVATE , hook | optional } , /* win2000 doesn't send it */
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* win2000 doesn't send it */
{ HCBT_SETFOCUS , hook | optional } , /* win2000 doesn't send it */
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | defwinproc } ,
{ WM_SIZE , sent | wparam | defwinproc , SIZE_RESTORED } ,
2006-12-30 15:03:03 +01:00
{ HCBT_SETFOCUS , hook | optional } , /* win2000 sends it */
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmRestore_2 [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 1 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
2008-03-04 20:00:13 +01:00
{ HCBT_ACTIVATE , hook | optional } , /* win2000 doesn't send it */
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* win2000 doesn't send it */
{ HCBT_SETFOCUS , hook | optional } , /* win2000 doesn't send it */
2006-12-22 11:32:04 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
{ 0 }
} ;
static const struct message WmRestore_3 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_RESTORE } ,
2006-12-22 11:32:04 +01:00
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2007-01-04 15:09:20 +01:00
{ HCBT_ACTIVATE , hook | optional } , /* win2003 doesn't send it */
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* win2003 doesn't send it */
{ HCBT_SETFOCUS , hook | optional } , /* win2003 doesn't send it */
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | defwinproc } ,
{ WM_SIZE , sent | wparam | defwinproc , SIZE_MAXIMIZED } ,
2007-01-04 15:09:20 +01:00
{ HCBT_SETFOCUS , hook | optional } , /* win2003 sends it */
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmRestore_4 [ ] = {
2009-02-12 17:52:54 +01:00
{ HCBT_MINMAX , hook | lparam | optional , 0 , SW_RESTORE } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOMOVE } ,
2009-01-15 15:43:58 +01:00
{ WM_MOVE , sent | defwinproc | optional } ,
2009-02-12 17:52:54 +01:00
{ WM_SIZE , sent | wparam | defwinproc | optional , SIZE_RESTORED } ,
2006-12-25 09:41:43 +01:00
{ 0 }
} ;
static const struct message WmRestore_5 [ ] = {
2009-02-25 12:25:03 +01:00
{ HCBT_MINMAX , hook | lparam | optional , 0 , SW_SHOWNORMAL } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOMOVE } ,
2009-01-15 15:43:58 +01:00
{ HCBT_ACTIVATE , hook | optional } ,
{ HCBT_SETFOCUS , hook | optional } ,
2009-02-25 12:25:03 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOMOVE } ,
2009-01-15 15:43:58 +01:00
{ WM_MOVE , sent | defwinproc | optional } ,
2009-02-25 12:25:03 +01:00
{ WM_SIZE , sent | wparam | defwinproc | optional , SIZE_RESTORED } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmHide_1 [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2009-12-16 12:28:41 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE , 0 , SWP_NOACTIVATE } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE , 0 , SWP_NOACTIVATE } ,
2009-02-12 17:52:54 +01:00
{ HCBT_ACTIVATE , hook | optional } ,
2006-12-30 15:03:03 +01:00
{ HCBT_SETFOCUS , hook | optional } , /* win2000 sends it */
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmHide_2 [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
2006-12-30 15:03:03 +01:00
{ WM_WINDOWPOSCHANGING , sent /*|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE*/ } , /* win2000 doesn't add SWP_NOACTIVATE */
{ WM_WINDOWPOSCHANGED , sent /*|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE*/ } , /* win2000 doesn't add SWP_NOACTIVATE */
2009-02-12 17:52:54 +01:00
{ HCBT_ACTIVATE , hook | optional } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmHide_3 [ ] = {
{ WM_SHOWWINDOW , sent | wparam , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2008-08-04 23:07:10 +02:00
{ HCBT_SETFOCUS , hook | optional } ,
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmShowMinimized_1 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMINIMIZED } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-30 15:03:03 +01:00
{ HCBT_ACTIVATE , hook | optional } , /* win2000 doesn't send it */
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* win2000 doesn't send it */
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | defwinproc } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | wparam | lparam | defwinproc , SIZE_MINIMIZED , 0 } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmMinimize_1 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_MINIMIZE } ,
2006-12-30 15:03:03 +01:00
{ HCBT_SETFOCUS , hook | optional } , /* win2000 doesn't send it */
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | defwinproc } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | wparam | lparam | defwinproc , SIZE_MINIMIZED , 0 } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmMinimize_2 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_MINIMIZE } ,
2008-08-04 23:07:10 +02:00
{ HCBT_SETFOCUS , hook | optional } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | defwinproc } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | wparam | lparam | defwinproc , SIZE_MINIMIZED , 0 } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmMinimize_3 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_MINIMIZE } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | defwinproc } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | wparam | lparam | defwinproc , SIZE_MINIMIZED , 0 } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmShowMinNoActivate [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMINNOACTIVE } ,
2009-02-25 12:25:03 +01:00
{ WM_WINDOWPOSCHANGING , sent } ,
{ WM_WINDOWPOSCHANGED , sent } ,
{ WM_MOVE , sent | defwinproc | optional } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | wparam | lparam | defwinproc | optional , SIZE_MINIMIZED , 0 } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
2006-12-25 09:41:43 +01:00
static const struct message WmMinMax_1 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMINIMIZED } ,
{ 0 }
} ;
static const struct message WmMinMax_2 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMAXIMIZED } ,
2009-01-15 15:43:58 +01:00
{ WM_GETMINMAXINFO , sent | optional } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_FRAMECHANGED | SWP_STATECHANGED } ,
{ HCBT_ACTIVATE , hook | optional } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
{ HCBT_SETFOCUS , hook | optional } ,
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
{ WM_MOVE , sent | defwinproc | optional } ,
{ WM_SIZE , sent | wparam | defwinproc | optional , SIZE_MAXIMIZED } ,
{ HCBT_SETFOCUS , hook | optional } ,
2006-12-25 09:41:43 +01:00
{ 0 }
} ;
static const struct message WmMinMax_3 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_MINIMIZE } ,
2009-02-12 17:52:54 +01:00
{ HCBT_SETFOCUS , hook | optional } ,
2009-02-24 14:58:02 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
{ WM_MOVE , sent | defwinproc | optional } ,
2009-08-03 08:06:53 +02:00
{ WM_SIZE , sent | wparam | lparam | defwinproc | optional , SIZE_MINIMIZED , 0 } ,
2006-12-25 09:41:43 +01:00
{ 0 }
} ;
static const struct message WmMinMax_4 [ ] = {
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMINNOACTIVE } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmShowMaximized_1 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMAXIMIZED } ,
2006-12-22 11:32:04 +01:00
{ WM_GETMINMAXINFO , sent } ,
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-30 15:03:03 +01:00
{ HCBT_ACTIVATE , hook | optional } , /* win2000 doesn't send it */
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* win2000 doesn't send it */
{ HCBT_SETFOCUS , hook | optional } , /* win2000 doesn't send it */
2008-04-17 19:29:15 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | defwinproc } ,
{ WM_SIZE , sent | wparam | defwinproc , SIZE_MAXIMIZED } ,
2007-01-04 15:09:20 +01:00
{ HCBT_SETFOCUS , hook | optional } , /* win2003 sends it */
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmShowMaximized_2 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMAXIMIZED } ,
2006-12-22 11:32:04 +01:00
{ WM_GETMINMAXINFO , sent } ,
2008-08-04 23:07:10 +02:00
{ WM_WINDOWPOSCHANGING , sent | optional } ,
{ HCBT_ACTIVATE , hook | optional } ,
{ WM_WINDOWPOSCHANGED , sent | optional } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | optional } , /* Win9x doesn't send it */
{ WM_SIZE , sent | wparam | optional , SIZE_MAXIMIZED } , /* Win9x doesn't send it */
2009-02-12 17:52:54 +01:00
{ WM_WINDOWPOSCHANGING , sent | optional } ,
2008-08-04 23:07:10 +02:00
{ HCBT_SETFOCUS , hook | optional } ,
2009-02-12 17:52:54 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_STATECHANGED } ,
2006-12-22 11:32:04 +01:00
{ WM_MOVE , sent | defwinproc } ,
{ WM_SIZE , sent | wparam | defwinproc , SIZE_MAXIMIZED } ,
2008-08-04 23:07:10 +02:00
{ HCBT_SETFOCUS , hook | optional } ,
2006-12-22 11:32:04 +01:00
{ 0 }
} ;
static const struct message WmShowMaximized_3 [ ] = {
2006-12-25 09:41:43 +01:00
{ HCBT_MINMAX , hook | lparam , 0 , SW_SHOWMAXIMIZED } ,
2009-06-03 20:33:45 +02:00
{ WM_GETMINMAXINFO , sent | optional } ,
2009-01-15 15:43:58 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOMOVE } ,
2008-03-04 20:00:13 +01:00
{ HCBT_ACTIVATE , hook | optional } , /* win2000 doesn't send it */
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } , /* win2000 doesn't send it */
{ HCBT_SETFOCUS , hook | optional } , /* win2000 doesn't send it */
2009-01-15 15:43:58 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam , SWP_FRAMECHANGED | SWP_STATECHANGED , 0 , SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_MOVE , sent | defwinproc | optional } ,
2006-12-22 11:32:04 +01:00
{ WM_SIZE , sent | wparam | defwinproc , SIZE_MAXIMIZED } ,
{ 0 }
} ;
static void test_ShowWindow ( void )
{
/* ShowWindow commands in random order */
static const struct
{
INT cmd ; /* ShowWindow command */
LPARAM ret ; /* ShowWindow return value */
DWORD style ; /* window style after the command */
const struct message * msg ; /* message sequence the command produces */
2010-09-01 13:58:06 +02:00
INT wp_cmd , wp_flags ; /* window placement after the command */
POINT wp_min , wp_max ; /* window placement after the command */
2006-12-22 11:32:04 +01:00
BOOL todo_msg ; /* message sequence doesn't match what Wine does */
} sw [ ] =
{
2010-09-01 13:58:06 +02:00
/* 1 */ { SW_SHOWNORMAL , FALSE , WS_VISIBLE , WmShowNormal ,
SW_SHOWNORMAL , 0 , { - 1 , - 1 } , { - 1 , - 1 } , FALSE } ,
/* 2 */ { SW_SHOWNORMAL , TRUE , WS_VISIBLE , WmEmptySeq ,
SW_SHOWNORMAL , 0 , { - 1 , - 1 } , { - 1 , - 1 } , FALSE } ,
/* 3 */ { SW_HIDE , TRUE , 0 , WmHide_1 ,
SW_SHOWNORMAL , 0 , { - 1 , - 1 } , { - 1 , - 1 } , FALSE } ,
/* 4 */ { SW_HIDE , FALSE , 0 , WmEmptySeq ,
SW_SHOWNORMAL , 0 , { - 1 , - 1 } , { - 1 , - 1 } , FALSE } ,
/* 5 */ { SW_SHOWMINIMIZED , FALSE , WS_VISIBLE | WS_MINIMIZE , WmShowMinimized_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 6 */ { SW_SHOWMINIMIZED , TRUE , WS_VISIBLE | WS_MINIMIZE , WmMinMax_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 7 */ { SW_HIDE , TRUE , WS_MINIMIZE , WmHide_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 8 */ { SW_HIDE , FALSE , WS_MINIMIZE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 9 */ { SW_SHOWMAXIMIZED , FALSE , WS_VISIBLE | WS_MAXIMIZE , WmShowMaximized_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMAXIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 10 */ { SW_SHOWMAXIMIZED , TRUE , WS_VISIBLE | WS_MAXIMIZE , WmMinMax_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMAXIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 11 */ { SW_HIDE , TRUE , WS_MAXIMIZE , WmHide_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMAXIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 12 */ { SW_HIDE , FALSE , WS_MAXIMIZE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWMAXIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 13 */ { SW_SHOWNOACTIVATE , FALSE , WS_VISIBLE , WmShowNoActivate_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 14 */ { SW_SHOWNOACTIVATE , TRUE , WS_VISIBLE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 15 */ { SW_HIDE , TRUE , 0 , WmHide_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 16 */ { SW_HIDE , FALSE , 0 , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 17 */ { SW_SHOW , FALSE , WS_VISIBLE , WmShow ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 18 */ { SW_SHOW , TRUE , WS_VISIBLE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 19 */ { SW_MINIMIZE , TRUE , WS_VISIBLE | WS_MINIMIZE , WmMinimize_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 20 */ { SW_MINIMIZE , TRUE , WS_VISIBLE | WS_MINIMIZE , WmMinMax_3 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 21 */ { SW_HIDE , TRUE , WS_MINIMIZE , WmHide_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 22 */ { SW_SHOWMINNOACTIVE , FALSE , WS_VISIBLE | WS_MINIMIZE , WmShowMinNoActivate ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , TRUE } ,
2010-09-01 13:58:06 +02:00
/* 23 */ { SW_SHOWMINNOACTIVE , TRUE , WS_VISIBLE | WS_MINIMIZE , WmMinMax_4 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 24 */ { SW_HIDE , TRUE , WS_MINIMIZE , WmHide_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 25 */ { SW_HIDE , FALSE , WS_MINIMIZE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 26 */ { SW_SHOWNA , FALSE , WS_VISIBLE | WS_MINIMIZE , WmShowNA_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 27 */ { SW_SHOWNA , TRUE , WS_VISIBLE | WS_MINIMIZE , WmShowNA_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 28 */ { SW_HIDE , TRUE , WS_MINIMIZE , WmHide_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 29 */ { SW_HIDE , FALSE , WS_MINIMIZE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 30 */ { SW_RESTORE , FALSE , WS_VISIBLE , WmRestore_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 31 */ { SW_RESTORE , TRUE , WS_VISIBLE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 32 */ { SW_HIDE , TRUE , 0 , WmHide_3 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 33 */ { SW_HIDE , FALSE , 0 , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 34 */ { SW_NORMALNA , FALSE , 0 , WmEmptySeq , /* what does this mean?! */
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 35 */ { SW_NORMALNA , FALSE , 0 , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 36 */ { SW_HIDE , FALSE , 0 , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 37 */ { SW_RESTORE , FALSE , WS_VISIBLE , WmRestore_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 38 */ { SW_RESTORE , TRUE , WS_VISIBLE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 39 */ { SW_SHOWNOACTIVATE , TRUE , WS_VISIBLE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 40 */ { SW_MINIMIZE , TRUE , WS_VISIBLE | WS_MINIMIZE , WmMinimize_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 41 */ { SW_MINIMIZE , TRUE , WS_VISIBLE | WS_MINIMIZE , WmMinMax_3 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 42 */ { SW_SHOWMAXIMIZED , TRUE , WS_VISIBLE | WS_MAXIMIZE , WmShowMaximized_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMAXIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 43 */ { SW_SHOWMAXIMIZED , TRUE , WS_VISIBLE | WS_MAXIMIZE , WmMinMax_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMAXIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 44 */ { SW_MINIMIZE , TRUE , WS_VISIBLE | WS_MINIMIZE , WmMinimize_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 45 */ { SW_MINIMIZE , TRUE , WS_VISIBLE | WS_MINIMIZE , WmMinMax_3 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 46 */ { SW_RESTORE , TRUE , WS_VISIBLE | WS_MAXIMIZE , WmRestore_3 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMAXIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 47 */ { SW_RESTORE , TRUE , WS_VISIBLE , WmRestore_4 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 48 */ { SW_SHOWMAXIMIZED , TRUE , WS_VISIBLE | WS_MAXIMIZE , WmShowMaximized_3 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMAXIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 49 */ { SW_SHOW , TRUE , WS_VISIBLE | WS_MAXIMIZE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWMAXIMIZED , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 50 */ { SW_SHOWNORMAL , TRUE , WS_VISIBLE , WmRestore_5 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 51 */ { SW_SHOWNORMAL , TRUE , WS_VISIBLE , WmRestore_5 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 52 */ { SW_HIDE , TRUE , 0 , WmHide_1 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 53 */ { SW_HIDE , FALSE , 0 , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , WPF_RESTORETOMAXIMIZED , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 54 */ { SW_MINIMIZE , FALSE , WS_VISIBLE | WS_MINIMIZE , WmMinimize_3 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 55 */ { SW_HIDE , TRUE , WS_MINIMIZE , WmHide_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWMINIMIZED , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 56 */ { SW_SHOWNOACTIVATE , FALSE , WS_VISIBLE , WmShowNoActivate_2 ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE } ,
2010-09-01 13:58:06 +02:00
/* 57 */ { SW_SHOW , TRUE , WS_VISIBLE , WmEmptySeq ,
2010-09-22 10:50:27 +02:00
SW_SHOWNORMAL , 0 , { - 32000 , - 32000 } , { - 1 , - 1 } , FALSE }
2006-12-22 11:32:04 +01:00
} ;
HWND hwnd ;
DWORD style ;
LPARAM ret ;
INT i ;
2010-09-01 13:58:06 +02:00
WINDOWPLACEMENT wp ;
RECT win_rc , work_rc = { 0 , 0 , 0 , 0 } ;
2006-12-22 11:32:04 +01:00
# define WS_BASE (WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_POPUP|WS_CLIPSIBLINGS)
hwnd = CreateWindowEx ( 0 , " ShowWindowClass " , NULL , WS_BASE ,
120 , 120 , 90 , 90 ,
0 , 0 , 0 , NULL ) ;
assert ( hwnd ) ;
style = GetWindowLong ( hwnd , GWL_STYLE ) & ~ WS_BASE ;
ok ( style = = 0 , " expected style 0, got %08x \n " , style ) ;
flush_events ( ) ;
flush_sequence ( ) ;
2010-09-01 13:58:06 +02:00
if ( pGetMonitorInfoA & & pMonitorFromPoint )
{
HMONITOR hmon ;
MONITORINFO mi ;
POINT pt = { 0 , 0 } ;
SetLastError ( 0xdeadbeef ) ;
hmon = pMonitorFromPoint ( pt , MONITOR_DEFAULTTOPRIMARY ) ;
ok ( hmon ! = 0 , " MonitorFromPoint error %u \n " , GetLastError ( ) ) ;
mi . cbSize = sizeof ( mi ) ;
SetLastError ( 0xdeadbeef ) ;
ret = pGetMonitorInfoA ( hmon , & mi ) ;
ok ( ret , " GetMonitorInfo error %u \n " , GetLastError ( ) ) ;
trace ( " monitor (%d,%d-%d,%d), work (%d,%d-%d,%d) \n " ,
mi . rcMonitor . left , mi . rcMonitor . top , mi . rcMonitor . right , mi . rcMonitor . bottom ,
mi . rcWork . left , mi . rcWork . top , mi . rcWork . right , mi . rcWork . bottom ) ;
work_rc = mi . rcWork ;
}
GetWindowRect ( hwnd , & win_rc ) ;
OffsetRect ( & win_rc , - work_rc . left , - work_rc . top ) ;
wp . length = sizeof ( wp ) ;
SetLastError ( 0xdeadbeaf ) ;
ret = GetWindowPlacement ( hwnd , & wp ) ;
ok ( ret , " GetWindowPlacement error %u \n " , GetLastError ( ) ) ;
ok ( wp . flags = = 0 , " expected 0, got %#x \n " , wp . flags ) ;
ok ( wp . showCmd = = SW_SHOWNORMAL , " expected SW_SHOWNORMAL, got %d \n " , wp . showCmd ) ;
ok ( wp . ptMinPosition . x = = - 1 & & wp . ptMinPosition . y = = - 1 ,
" expected -1,-1 got %d,%d \n " , wp . ptMinPosition . x , wp . ptMinPosition . y ) ;
ok ( wp . ptMaxPosition . x = = - 1 & & wp . ptMaxPosition . y = = - 1 ,
" expected -1,-1 got %d,%d \n " , wp . ptMaxPosition . x , wp . ptMaxPosition . y ) ;
if ( work_rc . left | | work_rc . top ) todo_wine /* FIXME: remove once Wine is fixed */
ok ( EqualRect ( & win_rc , & wp . rcNormalPosition ) ,
" expected %d,%d-%d,%d got %d,%d-%d,%d \n " ,
win_rc . left , win_rc . top , win_rc . right , win_rc . bottom ,
wp . rcNormalPosition . left , wp . rcNormalPosition . top ,
wp . rcNormalPosition . right , wp . rcNormalPosition . bottom ) ;
else
ok ( EqualRect ( & win_rc , & wp . rcNormalPosition ) ,
" expected %d,%d-%d,%d got %d,%d-%d,%d \n " ,
win_rc . left , win_rc . top , win_rc . right , win_rc . bottom ,
wp . rcNormalPosition . left , wp . rcNormalPosition . top ,
wp . rcNormalPosition . right , wp . rcNormalPosition . bottom ) ;
2006-12-22 11:32:04 +01:00
for ( i = 0 ; i < sizeof ( sw ) / sizeof ( sw [ 0 ] ) ; i + + )
{
static const char * const sw_cmd_name [ 13 ] =
{
" SW_HIDE " , " SW_SHOWNORMAL " , " SW_SHOWMINIMIZED " , " SW_SHOWMAXIMIZED " ,
" SW_SHOWNOACTIVATE " , " SW_SHOW " , " SW_MINIMIZE " , " SW_SHOWMINNOACTIVE " ,
" SW_SHOWNA " , " SW_RESTORE " , " SW_SHOWDEFAULT " , " SW_FORCEMINIMIZE " ,
" SW_NORMALNA " /* 0xCC */
} ;
char comment [ 64 ] ;
INT idx ; /* index into the above array of names */
idx = ( sw [ i ] . cmd = = SW_NORMALNA ) ? 12 : sw [ i ] . cmd ;
style = GetWindowLong ( hwnd , GWL_STYLE ) ;
trace ( " %d: sending %s, current window style %08x \n " , i + 1 , sw_cmd_name [ idx ] , style ) ;
ret = ShowWindow ( hwnd , sw [ i ] . cmd ) ;
ok ( ! ret = = ! sw [ i ] . ret , " %d: cmd %s: expected ret %lu, got %lu \n " , i + 1 , sw_cmd_name [ idx ] , sw [ i ] . ret , ret ) ;
style = GetWindowLong ( hwnd , GWL_STYLE ) & ~ WS_BASE ;
ok ( style = = sw [ i ] . style , " %d: expected style %08x, got %08x \n " , i + 1 , sw [ i ] . style , style ) ;
sprintf ( comment , " %d: ShowWindow(%s) " , i + 1 , sw_cmd_name [ idx ] ) ;
ok_sequence ( sw [ i ] . msg , comment , sw [ i ] . todo_msg ) ;
2010-09-01 13:58:06 +02:00
wp . length = sizeof ( wp ) ;
SetLastError ( 0xdeadbeaf ) ;
ret = GetWindowPlacement ( hwnd , & wp ) ;
ok ( ret , " GetWindowPlacement error %u \n " , GetLastError ( ) ) ;
ok ( wp . flags = = sw [ i ] . wp_flags , " expected %#x, got %#x \n " , sw [ i ] . wp_flags , wp . flags ) ;
ok ( wp . showCmd = = sw [ i ] . wp_cmd , " expected %d, got %d \n " , sw [ i ] . wp_cmd , wp . showCmd ) ;
2010-09-22 10:50:27 +02:00
2010-09-01 13:58:06 +02:00
/* NT moves the minimized window to -32000,-32000, win9x to 3000,3000 */
if ( ( wp . ptMinPosition . x + work_rc . left = = - 32000 & & wp . ptMinPosition . y + work_rc . top = = - 32000 ) | |
( wp . ptMinPosition . x + work_rc . left = = 3000 & & wp . ptMinPosition . y + work_rc . top = = 3000 ) )
2010-09-22 10:50:27 +02:00
{
ok ( ( wp . ptMinPosition . x + work_rc . left = = sw [ i ] . wp_min . x & & wp . ptMinPosition . y + work_rc . top = = sw [ i ] . wp_min . y ) | |
( wp . ptMinPosition . x + work_rc . left = = 3000 & & wp . ptMinPosition . y + work_rc . top = = 3000 ) ,
" expected %d,%d got %d,%d \n " , sw [ i ] . wp_min . x , sw [ i ] . wp_min . y , wp . ptMinPosition . x , wp . ptMinPosition . y ) ;
}
else
{
if ( wp . ptMinPosition . x ! = sw [ i ] . wp_min . x | | wp . ptMinPosition . y ! = sw [ i ] . wp_min . y )
todo_wine
ok ( wp . ptMinPosition . x = = sw [ i ] . wp_min . x & & wp . ptMinPosition . y = = sw [ i ] . wp_min . y ,
" expected %d,%d got %d,%d \n " , sw [ i ] . wp_min . x , sw [ i ] . wp_min . y , wp . ptMinPosition . x , wp . ptMinPosition . y ) ;
else
ok ( wp . ptMinPosition . x = = sw [ i ] . wp_min . x & & wp . ptMinPosition . y = = sw [ i ] . wp_min . y ,
" expected %d,%d got %d,%d \n " , sw [ i ] . wp_min . x , sw [ i ] . wp_min . y , wp . ptMinPosition . x , wp . ptMinPosition . y ) ;
}
if ( wp . ptMaxPosition . x ! = sw [ i ] . wp_max . x | | wp . ptMaxPosition . y ! = sw [ i ] . wp_max . y )
2010-09-01 13:58:06 +02:00
todo_wine
2010-09-22 10:50:27 +02:00
ok ( wp . ptMaxPosition . x = = sw [ i ] . wp_max . x & & wp . ptMaxPosition . y = = sw [ i ] . wp_max . y ,
" expected %d,%d got %d,%d \n " , sw [ i ] . wp_max . x , sw [ i ] . wp_max . y , wp . ptMaxPosition . x , wp . ptMaxPosition . y ) ;
2010-09-01 13:58:06 +02:00
else
2010-09-22 10:50:27 +02:00
ok ( wp . ptMaxPosition . x = = sw [ i ] . wp_max . x & & wp . ptMaxPosition . y = = sw [ i ] . wp_max . y ,
" expected %d,%d got %d,%d \n " , sw [ i ] . wp_max . x , sw [ i ] . wp_max . y , wp . ptMaxPosition . x , wp . ptMaxPosition . y ) ;
2010-09-01 13:58:06 +02:00
2010-09-22 10:50:27 +02:00
if ( 0 ) /* FIXME: Wine behaves completely different here */
2010-09-01 13:58:06 +02:00
ok ( EqualRect ( & win_rc , & wp . rcNormalPosition ) ,
" expected %d,%d-%d,%d got %d,%d-%d,%d \n " ,
win_rc . left , win_rc . top , win_rc . right , win_rc . bottom ,
wp . rcNormalPosition . left , wp . rcNormalPosition . top ,
wp . rcNormalPosition . right , wp . rcNormalPosition . bottom ) ;
2010-09-22 10:50:27 +02:00
2006-12-22 11:32:04 +01:00
flush_events ( ) ;
flush_sequence ( ) ;
}
DestroyWindow ( hwnd ) ;
}
2007-05-08 10:47:41 +02:00
static INT_PTR WINAPI test_dlg_proc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam )
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2007-05-08 10:47:41 +02:00
2009-05-12 12:09:30 +02:00
if ( ignore_message ( message ) ) return 0 ;
2007-05-08 10:47:41 +02:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2007-05-08 10:47:41 +02:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
msg . wParam = wParam ;
msg . lParam = lParam ;
2009-01-12 21:03:57 +01:00
msg . descr = " dialog " ;
2007-05-08 10:47:41 +02:00
add_message ( & msg ) ;
/* calling DefDlgProc leads to a recursion under XP */
switch ( message )
{
case WM_INITDIALOG :
case WM_GETDLGCODE :
return 0 ;
}
return 1 ;
}
2007-02-20 10:06:21 +01:00
static const struct message WmDefDlgSetFocus_1 [ ] = {
{ WM_GETDLGCODE , sent | wparam | lparam , 0 , 0 } ,
{ WM_GETTEXTLENGTH , sent | wparam | lparam | optional , 0 , 0 } , /* XP */
{ WM_GETTEXT , sent | wparam | optional , 6 } , /* XP */
{ WM_GETTEXT , sent | wparam | optional , 12 } , /* XP */
{ EM_SETSEL , sent | wparam , 0 } , /* XP sets lparam to text length, Win9x to -2 */
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
{ WM_SETFOCUS , sent | wparam , 0 } ,
2008-03-04 20:00:13 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 10 } ,
2007-02-20 10:06:21 +01:00
{ WM_CTLCOLOREDIT , sent } ,
2008-03-04 20:00:13 +01:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 11 } ,
2007-02-20 10:06:21 +01:00
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_LOCATIONCHANGE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
{ WM_COMMAND , sent | wparam , MAKEWPARAM ( 1 , EN_SETFOCUS ) } ,
{ 0 }
} ;
static const struct message WmDefDlgSetFocus_2 [ ] = {
{ WM_GETDLGCODE , sent | wparam | lparam , 0 , 0 } ,
{ WM_GETTEXTLENGTH , sent | wparam | lparam | optional , 0 , 0 } , /* XP */
{ WM_GETTEXT , sent | wparam | optional , 6 } , /* XP */
{ WM_GETTEXT , sent | wparam | optional , 12 } , /* XP */
{ EM_SETSEL , sent | wparam , 0 } , /* XP sets lparam to text length, Win9x to -2 */
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_HIDE , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
2007-05-08 10:47:41 +02:00
{ WM_CTLCOLOREDIT , sent | optional } , /* XP */
2007-09-25 12:26:57 +02:00
{ EVENT_OBJECT_SHOW , winevent_hook | wparam | lparam , OBJID_CARET , 0 } ,
2007-05-08 10:47:41 +02:00
{ 0 }
} ;
/* Creation of a dialog */
static const struct message WmCreateDialogParamSeq_1 [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
{ WM_MOVE , sent } ,
{ WM_SETFONT , sent } ,
{ WM_INITDIALOG , sent } ,
{ WM_CHANGEUISTATE , sent | optional } ,
{ 0 }
} ;
/* Creation of a dialog */
static const struct message WmCreateDialogParamSeq_2 [ ] = {
{ HCBT_CREATEWND , hook } ,
{ WM_NCCREATE , sent } ,
{ WM_NCCALCSIZE , sent | wparam , 0 } ,
{ WM_CREATE , sent } ,
{ EVENT_OBJECT_CREATE , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_SIZE , sent | wparam , SIZE_RESTORED } ,
{ WM_MOVE , sent } ,
{ WM_CHANGEUISTATE , sent | optional } ,
2007-02-20 10:06:21 +01:00
{ 0 }
} ;
static void test_dialog_messages ( void )
{
2007-05-08 10:47:41 +02:00
WNDCLASS cls ;
2007-02-20 10:06:21 +01:00
HWND hdlg , hedit1 , hedit2 , hfocus ;
LRESULT ret ;
# define set_selection(hctl, start, end) \
ret = SendMessage ( hctl , EM_SETSEL , start , end ) ; \
ok ( ret = = 1 , " EM_SETSEL returned %ld \n " , ret ) ;
# define check_selection(hctl, start, end) \
ret = SendMessage ( hctl , EM_GETSEL , 0 , 0 ) ; \
ok ( ret = = MAKELRESULT ( start , end ) , " wrong selection (%d - %d) \n " , LOWORD ( ret ) , HIWORD ( ret ) ) ;
subclass_edit ( ) ;
hdlg = CreateWindowEx ( WS_EX_DLGMODALFRAME , " TestDialogClass " , NULL ,
WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_DLGFRAME ,
0 , 0 , 100 , 100 , 0 , 0 , 0 , NULL ) ;
ok ( hdlg ! = 0 , " Failed to create custom dialog window \n " ) ;
hedit1 = CreateWindowEx ( 0 , " my_edit_class " , NULL ,
WS_CHILD | WS_BORDER | WS_VISIBLE | WS_TABSTOP ,
0 , 0 , 80 , 20 , hdlg , ( HMENU ) 1 , 0 , NULL ) ;
ok ( hedit1 ! = 0 , " Failed to create edit control \n " ) ;
hedit2 = CreateWindowEx ( 0 , " my_edit_class " , NULL ,
WS_CHILD | WS_BORDER | WS_VISIBLE | WS_TABSTOP ,
0 , 40 , 80 , 20 , hdlg , ( HMENU ) 2 , 0 , NULL ) ;
ok ( hedit2 ! = 0 , " Failed to create edit control \n " ) ;
SendMessage ( hedit1 , WM_SETTEXT , 0 , ( LPARAM ) " hello " ) ;
SendMessage ( hedit2 , WM_SETTEXT , 0 , ( LPARAM ) " bye " ) ;
hfocus = GetFocus ( ) ;
ok ( hfocus = = hdlg , " wrong focus %p \n " , hfocus ) ;
SetFocus ( hedit2 ) ;
hfocus = GetFocus ( ) ;
ok ( hfocus = = hedit2 , " wrong focus %p \n " , hfocus ) ;
check_selection ( hedit1 , 0 , 0 ) ;
check_selection ( hedit2 , 0 , 0 ) ;
set_selection ( hedit2 , 0 , - 1 ) ;
check_selection ( hedit2 , 0 , 3 ) ;
SetFocus ( 0 ) ;
hfocus = GetFocus ( ) ;
ok ( hfocus = = 0 , " wrong focus %p \n " , hfocus ) ;
flush_sequence ( ) ;
ret = DefDlgProc ( hdlg , WM_SETFOCUS , 0 , 0 ) ;
ok ( ret = = 0 , " WM_SETFOCUS returned %ld \n " , ret ) ;
ok_sequence ( WmDefDlgSetFocus_1 , " DefDlgProc(WM_SETFOCUS) 1 " , FALSE ) ;
hfocus = GetFocus ( ) ;
ok ( hfocus = = hedit1 , " wrong focus %p \n " , hfocus ) ;
check_selection ( hedit1 , 0 , 5 ) ;
check_selection ( hedit2 , 0 , 3 ) ;
flush_sequence ( ) ;
ret = DefDlgProc ( hdlg , WM_SETFOCUS , 0 , 0 ) ;
ok ( ret = = 0 , " WM_SETFOCUS returned %ld \n " , ret ) ;
ok_sequence ( WmDefDlgSetFocus_2 , " DefDlgProc(WM_SETFOCUS) 2 " , FALSE ) ;
hfocus = GetFocus ( ) ;
ok ( hfocus = = hedit1 , " wrong focus %p \n " , hfocus ) ;
check_selection ( hedit1 , 0 , 5 ) ;
check_selection ( hedit2 , 0 , 3 ) ;
EndDialog ( hdlg , 0 ) ;
2007-07-18 14:06:40 +02:00
DestroyWindow ( hedit1 ) ;
DestroyWindow ( hedit2 ) ;
DestroyWindow ( hdlg ) ;
2007-05-08 10:47:41 +02:00
flush_sequence ( ) ;
2007-02-20 10:06:21 +01:00
# undef set_selection
# undef check_selection
2007-05-08 10:47:41 +02:00
ok ( GetClassInfo ( 0 , " #32770 " , & cls ) , " GetClassInfo failed \n " ) ;
cls . lpszClassName = " MyDialogClass " ;
cls . hInstance = GetModuleHandle ( 0 ) ;
/* need a cast since a dlgproc is used as a wndproc */
cls . lpfnWndProc = ( WNDPROC ) test_dlg_proc ;
if ( ! RegisterClass ( & cls ) ) assert ( 0 ) ;
hdlg = CreateDialogParam ( 0 , " CLASS_TEST_DIALOG_2 " , 0 , test_dlg_proc , 0 ) ;
ok ( IsWindow ( hdlg ) , " CreateDialogParam failed \n " ) ;
ok_sequence ( WmCreateDialogParamSeq_1 , " CreateDialogParam_1 " , FALSE ) ;
EndDialog ( hdlg , 0 ) ;
2007-07-18 14:06:40 +02:00
DestroyWindow ( hdlg ) ;
2007-05-08 10:47:41 +02:00
flush_sequence ( ) ;
hdlg = CreateDialogParam ( 0 , " CLASS_TEST_DIALOG_2 " , 0 , NULL , 0 ) ;
ok ( IsWindow ( hdlg ) , " CreateDialogParam failed \n " ) ;
ok_sequence ( WmCreateDialogParamSeq_2 , " CreateDialogParam_2 " , FALSE ) ;
EndDialog ( hdlg , 0 ) ;
2007-07-18 14:06:40 +02:00
DestroyWindow ( hdlg ) ;
2007-05-08 10:47:41 +02:00
flush_sequence ( ) ;
UnregisterClass ( cls . lpszClassName , cls . hInstance ) ;
2007-02-20 10:06:21 +01:00
}
2007-02-24 19:57:22 +01:00
static void test_nullCallback ( void )
{
HWND hwnd ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test overlapped " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
SendMessageCallbackA ( hwnd , WM_NULL , 0 , 0 , NULL , 0 ) ;
2007-08-20 22:01:55 +02:00
flush_events ( ) ;
2007-02-24 19:57:22 +01:00
DestroyWindow ( hwnd ) ;
}
2008-06-25 14:40:41 +02:00
/* SetActiveWindow( 0 ) hwnd visible */
static const struct message SetActiveWindowSeq0 [ ] =
{
2009-02-12 17:52:54 +01:00
{ HCBT_ACTIVATE , hook | optional } ,
2008-06-25 14:40:41 +02:00
{ WM_NCACTIVATE , sent | wparam , 0 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ACTIVATE , sent | wparam , 0 } ,
2009-02-13 13:02:08 +01:00
{ WM_ACTIVATEAPP , sent | wparam | optional , 0 } ,
{ WM_ACTIVATEAPP , sent | wparam | optional , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2009-03-06 10:38:39 +01:00
{ WM_KILLFOCUS , sent | optional } ,
2009-02-16 11:52:17 +01:00
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_NCACTIVATE , sent | wparam | optional , 1 } ,
2008-06-25 14:40:41 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2009-02-16 11:52:17 +01:00
{ WM_ACTIVATE , sent | wparam | optional , 1 } ,
{ HCBT_SETFOCUS , hook | optional } ,
2009-03-06 10:38:39 +01:00
{ WM_KILLFOCUS , sent | defwinproc | optional } ,
{ WM_IME_SETCONTEXT , sent | defwinproc | optional } ,
{ WM_IME_SETCONTEXT , sent | defwinproc | optional } ,
2009-03-09 17:54:16 +01:00
{ WM_IME_SETCONTEXT , sent | optional } ,
{ WM_IME_SETCONTEXT , sent | optional } ,
2008-06-25 14:40:41 +02:00
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
2009-02-16 11:52:17 +01:00
{ WM_SETFOCUS , sent | defwinproc | optional } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2008-06-25 14:40:41 +02:00
{ 0 }
} ;
/* SetActiveWindow( hwnd ) hwnd visible */
static const struct message SetActiveWindowSeq1 [ ] =
{
2008-09-16 16:27:47 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2008-06-25 14:40:41 +02:00
{ 0 }
} ;
/* SetActiveWindow( popup ) hwnd visible, popup visible */
static const struct message SetActiveWindowSeq2 [ ] =
{
{ HCBT_ACTIVATE , hook } ,
{ WM_NCACTIVATE , sent | wparam , 0 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ACTIVATE , sent | wparam , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_WINDOWPOSCHANGING , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
2008-06-25 14:40:41 +02:00
{ WM_NCPAINT , sent | optional } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ERASEBKGND , sent | optional } ,
2008-07-31 17:16:22 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2008-06-25 14:40:41 +02:00
{ WM_NCACTIVATE , sent | wparam , 1 } ,
2008-07-31 17:16:22 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2008-06-25 14:40:41 +02:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent | defwinproc } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
{ WM_SETFOCUS , sent | defwinproc } ,
2008-09-22 12:14:56 +02:00
{ WM_GETTEXT , sent | optional } ,
2008-06-25 14:40:41 +02:00
{ 0 }
} ;
/* SetActiveWindow( hwnd ) hwnd not visible */
static const struct message SetActiveWindowSeq3 [ ] =
{
{ HCBT_ACTIVATE , hook } ,
2008-09-16 16:27:47 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2008-06-25 14:40:41 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOSIZE | SWP_NOMOVE } ,
2008-08-04 23:07:10 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2008-06-25 14:40:41 +02:00
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
{ WM_ACTIVATEAPP , sent | wparam , 1 } ,
{ WM_NCACTIVATE , sent | wparam , 1 } ,
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
{ WM_SETFOCUS , sent | defwinproc } ,
{ 0 }
} ;
/* SetActiveWindow( popup ) hwnd not visible, popup not visible */
static const struct message SetActiveWindowSeq4 [ ] =
{
{ HCBT_ACTIVATE , hook } ,
{ WM_NCACTIVATE , sent | wparam , 0 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ACTIVATE , sent | wparam , 0 } ,
2008-09-16 16:27:47 +02:00
{ WM_QUERYNEWPALETTE , sent | wparam | lparam | optional , 0 , 0 } ,
2008-06-25 14:40:41 +02:00
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOSIZE | SWP_NOMOVE } ,
{ WM_WINDOWPOSCHANGING , sent | wparam , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE } ,
2008-07-31 17:16:22 +02:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2009-12-16 12:28:41 +01:00
{ WM_WINDOWPOSCHANGED , sent | wparam | optional , SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE } ,
2008-06-25 14:40:41 +02:00
{ WM_NCACTIVATE , sent | wparam , 1 } ,
2008-07-31 17:16:22 +02:00
{ WM_GETTEXT , sent | defwinproc | optional } ,
2008-06-25 14:40:41 +02:00
{ WM_ACTIVATE , sent | wparam , 1 } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent | defwinproc } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 0 } ,
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 1 } ,
{ WM_IME_NOTIFY , sent | wparam | defwinproc | optional , 2 } ,
{ WM_SETFOCUS , sent | defwinproc } ,
{ 0 }
} ;
static void test_SetActiveWindow ( void )
{
HWND hwnd , popup , ret ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test SetActiveWindow " ,
WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
popup = CreateWindowExA ( 0 , " TestWindowClass " , " Test SetActiveWindow " ,
WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_POPUP ,
100 , 100 , 200 , 200 , hwnd , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
ok ( popup ! = 0 , " Failed to create popup window \n " ) ;
2009-01-16 12:33:07 +01:00
SetForegroundWindow ( popup ) ;
2008-06-25 14:40:41 +02:00
flush_sequence ( ) ;
trace ( " SetActiveWindow(0) \n " ) ;
ret = SetActiveWindow ( 0 ) ;
ok ( ret = = popup , " Failed to SetActiveWindow(0) \n " ) ;
2009-03-06 10:38:39 +01:00
ok_sequence ( SetActiveWindowSeq0 , " SetActiveWindow(0) " , FALSE ) ;
2008-06-25 14:40:41 +02:00
flush_sequence ( ) ;
trace ( " SetActiveWindow(hwnd), hwnd visible \n " ) ;
ret = SetActiveWindow ( hwnd ) ;
2009-02-12 17:52:54 +01:00
if ( ret = = hwnd ) ok_sequence ( SetActiveWindowSeq1 , " SetActiveWindow(hwnd), hwnd visible " , TRUE ) ;
2008-06-25 14:40:41 +02:00
flush_sequence ( ) ;
2008-07-31 17:16:22 +02:00
trace ( " SetActiveWindow(popup), hwnd visible, popup visible \n " ) ;
2008-06-25 14:40:41 +02:00
ret = SetActiveWindow ( popup ) ;
2008-07-31 17:16:22 +02:00
ok ( ret = = hwnd , " Failed to SetActiveWindow(popup), popup visible \n " ) ;
2008-09-16 16:27:47 +02:00
ok_sequence ( SetActiveWindowSeq2 , " SetActiveWindow(popup), hwnd visible, popup visible " , FALSE ) ;
2008-06-25 14:40:41 +02:00
flush_sequence ( ) ;
ShowWindow ( hwnd , SW_HIDE ) ;
ShowWindow ( popup , SW_HIDE ) ;
flush_sequence ( ) ;
trace ( " SetActiveWindow(hwnd), hwnd not visible \n " ) ;
ret = SetActiveWindow ( hwnd ) ;
2009-01-16 12:33:07 +01:00
ok ( ret = = NULL , " SetActiveWindow(hwnd), hwnd not visible, previous is %p \n " , ret ) ;
2008-06-25 14:40:41 +02:00
ok_sequence ( SetActiveWindowSeq3 , " SetActiveWindow(hwnd), hwnd not visible " , TRUE ) ;
flush_sequence ( ) ;
2008-07-31 17:16:22 +02:00
trace ( " SetActiveWindow(popup), hwnd not visible, popup not visible \n " ) ;
2008-06-25 14:40:41 +02:00
ret = SetActiveWindow ( popup ) ;
ok ( ret = = hwnd , " Failed to SetActiveWindow(popup) \n " ) ;
2008-07-31 17:16:22 +02:00
ok_sequence ( SetActiveWindowSeq4 , " SetActiveWindow(popup), hwnd not visible, popup not visible " , TRUE ) ;
2008-06-25 14:40:41 +02:00
flush_sequence ( ) ;
trace ( " done \n " ) ;
DestroyWindow ( hwnd ) ;
}
2007-06-01 07:30:54 +02:00
static const struct message SetForegroundWindowSeq [ ] =
{
{ WM_NCACTIVATE , sent | wparam , 0 } ,
{ WM_GETTEXT , sent | defwinproc | optional } ,
{ WM_ACTIVATE , sent | wparam , 0 } ,
{ WM_ACTIVATEAPP , sent | wparam , 0 } ,
{ WM_KILLFOCUS , sent } ,
2007-09-25 12:26:57 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | optional , 0 } ,
{ WM_IME_NOTIFY , sent | wparam | optional | defwinproc , 1 } ,
2007-06-01 07:30:54 +02:00
{ 0 }
} ;
static void test_SetForegroundWindow ( void )
{
HWND hwnd ;
hwnd = CreateWindowExA ( 0 , " TestWindowClass " , " Test SetForegroundWindow " ,
WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
2009-02-12 17:52:54 +01:00
SetForegroundWindow ( hwnd ) ;
2007-06-01 07:30:54 +02:00
flush_sequence ( ) ;
trace ( " SetForegroundWindow( 0 ) \n " ) ;
SetForegroundWindow ( 0 ) ;
ok_sequence ( WmEmptySeq , " SetForegroundWindow( 0 ) away from foreground top level window " , FALSE ) ;
trace ( " SetForegroundWindow( GetDesktopWindow() ) \n " ) ;
SetForegroundWindow ( GetDesktopWindow ( ) ) ;
ok_sequence ( SetForegroundWindowSeq , " SetForegroundWindow( desktop ) away from "
2007-07-20 15:15:39 +02:00
" foreground top level window " , FALSE ) ;
2007-06-01 07:30:54 +02:00
trace ( " done \n " ) ;
DestroyWindow ( hwnd ) ;
}
2007-08-08 18:25:57 +02:00
static void test_dbcs_wm_char ( void )
{
BYTE dbch [ 2 ] ;
WCHAR wch , bad_wch ;
HWND hwnd , hwnd2 ;
MSG msg ;
2007-08-08 20:35:24 +02:00
DWORD time ;
POINT pt ;
2007-08-08 18:25:57 +02:00
DWORD_PTR res ;
CPINFOEXA cpinfo ;
UINT i , j , k ;
struct message wmCharSeq [ 2 ] ;
2008-01-23 11:42:15 +01:00
if ( ! pGetCPInfoExA )
{
2009-02-23 10:41:03 +01:00
win_skip ( " GetCPInfoExA is not available \n " ) ;
2008-01-23 11:42:15 +01:00
return ;
}
2007-08-15 14:23:45 +02:00
pGetCPInfoExA ( CP_ACP , 0 , & cpinfo ) ;
2007-08-08 18:25:57 +02:00
if ( cpinfo . MaxCharSize ! = 2 )
{
skip ( " Skipping DBCS WM_CHAR test in SBCS codepage '%s' \n " , cpinfo . CodePageName ) ;
return ;
}
dbch [ 0 ] = dbch [ 1 ] = 0 ;
wch = 0 ;
bad_wch = cpinfo . UnicodeDefaultChar ;
for ( i = 0 ; ! wch & & i < MAX_LEADBYTES & & cpinfo . LeadByte [ i ] ; i + = 2 )
for ( j = cpinfo . LeadByte [ i ] ; ! wch & & j < = cpinfo . LeadByte [ i + 1 ] ; j + + )
for ( k = 128 ; k < = 255 ; k + + )
{
char str [ 2 ] ;
WCHAR wstr [ 2 ] ;
str [ 0 ] = j ;
str [ 1 ] = k ;
if ( MultiByteToWideChar ( CP_ACP , 0 , str , 2 , wstr , 2 ) = = 1 & &
WideCharToMultiByte ( CP_ACP , 0 , wstr , 1 , str , 2 , NULL , NULL ) = = 2 & &
( BYTE ) str [ 0 ] = = j & & ( BYTE ) str [ 1 ] = = k & &
HIBYTE ( wstr [ 0 ] ) & & HIBYTE ( wstr [ 0 ] ) ! = 0xff )
{
dbch [ 0 ] = j ;
dbch [ 1 ] = k ;
wch = wstr [ 0 ] ;
break ;
}
}
if ( ! wch )
{
skip ( " Skipping DBCS WM_CHAR test, no appropriate char found \n " ) ;
return ;
}
trace ( " using dbcs char %02x,%02x wchar %04x bad wchar %04x codepage '%s' \n " ,
dbch [ 0 ] , dbch [ 1 ] , wch , bad_wch , cpinfo . CodePageName ) ;
hwnd = CreateWindowExW ( 0 , testWindowClassW , NULL ,
WS_OVERLAPPEDWINDOW , 100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
hwnd2 = CreateWindowExW ( 0 , testWindowClassW , NULL ,
WS_OVERLAPPEDWINDOW , 100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " Failed to create overlapped window \n " ) ;
ok ( hwnd2 ! = 0 , " Failed to create overlapped window \n " ) ;
flush_sequence ( ) ;
memset ( wmCharSeq , 0 , sizeof ( wmCharSeq ) ) ;
wmCharSeq [ 0 ] . message = WM_CHAR ;
wmCharSeq [ 0 ] . flags = sent | wparam ;
wmCharSeq [ 0 ] . wParam = wch ;
/* posted message */
PostMessageA ( hwnd , WM_CHAR , dbch [ 0 ] , 0 ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
PostMessageA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok ( PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = wch , " bad wparam %lx/%x \n " , msg . wParam , wch ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* posted thread message */
PostThreadMessageA ( GetCurrentThreadId ( ) , WM_CHAR , dbch [ 0 ] , 0 ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
PostMessageA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok ( PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = wch , " bad wparam %lx/%x \n " , msg . wParam , wch ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* sent message */
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_CHAR , dbch [ 0 ] , 0 ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
SendMessageA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* sent message with timeout */
flush_sequence ( ) ;
SendMessageTimeoutA ( hwnd , WM_CHAR , dbch [ 0 ] , 0 , SMTO_NORMAL , 0 , & res ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
SendMessageTimeoutA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 , SMTO_NORMAL , 0 , & res ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* sent message with timeout and callback */
flush_sequence ( ) ;
SendMessageTimeoutA ( hwnd , WM_CHAR , dbch [ 0 ] , 0 , SMTO_NORMAL , 0 , & res ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
SendMessageCallbackA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 , NULL , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* sent message with callback */
flush_sequence ( ) ;
SendNotifyMessageA ( hwnd , WM_CHAR , dbch [ 0 ] , 0 ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
SendMessageCallbackA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 , NULL , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* direct window proc call */
flush_sequence ( ) ;
CallWindowProcA ( ( WNDPROC ) GetWindowLongPtrA ( hwnd , GWLP_WNDPROC ) , hwnd , WM_CHAR , dbch [ 0 ] , 0 ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
CallWindowProcA ( ( WNDPROC ) GetWindowLongPtrA ( hwnd , GWLP_WNDPROC ) , hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
/* dispatch message */
msg . hwnd = hwnd ;
msg . message = WM_CHAR ;
msg . wParam = dbch [ 0 ] ;
msg . lParam = 0 ;
DispatchMessageA ( & msg ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
msg . wParam = dbch [ 1 ] ;
DispatchMessageA ( & msg ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
/* window handle is irrelevant */
flush_sequence ( ) ;
SendMessageA ( hwnd2 , WM_CHAR , dbch [ 0 ] , 0 ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
SendMessageA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* interleaved post and send */
flush_sequence ( ) ;
PostMessageA ( hwnd2 , WM_CHAR , dbch [ 0 ] , 0 ) ;
SendMessageA ( hwnd2 , WM_CHAR , dbch [ 0 ] , 0 ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
PostMessageA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
ok ( PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = wch , " bad wparam %lx/%x \n " , msg . wParam , wch ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
SendMessageA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* interleaved sent message and winproc */
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_CHAR , dbch [ 0 ] , 0 ) ;
CallWindowProcA ( ( WNDPROC ) GetWindowLongPtrA ( hwnd , GWLP_WNDPROC ) , hwnd , WM_CHAR , dbch [ 0 ] , 0 ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
SendMessageA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
CallWindowProcA ( ( WNDPROC ) GetWindowLongPtrA ( hwnd , GWLP_WNDPROC ) , hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
/* interleaved winproc and dispatch */
msg . hwnd = hwnd ;
msg . message = WM_CHAR ;
msg . wParam = dbch [ 0 ] ;
msg . lParam = 0 ;
CallWindowProcA ( ( WNDPROC ) GetWindowLongPtrA ( hwnd , GWLP_WNDPROC ) , hwnd , WM_CHAR , dbch [ 0 ] , 0 ) ;
DispatchMessageA ( & msg ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
msg . wParam = dbch [ 1 ] ;
DispatchMessageA ( & msg ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
CallWindowProcA ( ( WNDPROC ) GetWindowLongPtrA ( hwnd , GWLP_WNDPROC ) , hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
/* interleaved sends */
flush_sequence ( ) ;
SendMessageA ( hwnd , WM_CHAR , dbch [ 0 ] , 0 ) ;
SendMessageCallbackA ( hwnd , WM_CHAR , dbch [ 0 ] , 0 , NULL , 0 ) ;
ok_sequence ( WmEmptySeq , " no messages " , FALSE ) ;
SendMessageTimeoutA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 , SMTO_NORMAL , 0 , & res ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
SendMessageA ( hwnd , WM_CHAR , dbch [ 1 ] , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
/* dbcs WM_CHAR */
flush_sequence ( ) ;
SendMessageA ( hwnd2 , WM_CHAR , ( dbch [ 1 ] < < 8 ) | dbch [ 0 ] , 0 ) ;
ok_sequence ( wmCharSeq , " Unicode WM_CHAR " , FALSE ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* other char messages are not magic */
PostMessageA ( hwnd , WM_SYSCHAR , dbch [ 0 ] , 0 ) ;
ok ( PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . message = = WM_SYSCHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = bad_wch , " bad wparam %lx/%x \n " , msg . wParam , bad_wch ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
PostMessageA ( hwnd , WM_DEADCHAR , dbch [ 0 ] , 0 ) ;
ok ( PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . message = = WM_DEADCHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = bad_wch , " bad wparam %lx/%x \n " , msg . wParam , bad_wch ) ;
ok ( ! PeekMessageW ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
2007-08-08 20:35:24 +02:00
/* test retrieving messages */
PostMessageW ( hwnd , WM_CHAR , wch , 0 ) ;
ok ( PeekMessageA ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 0 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
ok ( PeekMessageA ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 1 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
ok ( ! PeekMessageA ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* message filters */
PostMessageW ( hwnd , WM_CHAR , wch , 0 ) ;
ok ( PeekMessageA ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 0 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
/* message id is filtered, hwnd is not */
ok ( ! PeekMessageA ( & msg , hwnd , WM_MOUSEFIRST , WM_MOUSELAST , PM_REMOVE ) , " no message \n " ) ;
ok ( PeekMessageA ( & msg , hwnd2 , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 1 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
ok ( ! PeekMessageA ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* mixing GetMessage and PostMessage */
PostMessageW ( hwnd , WM_CHAR , wch , 0xbeef ) ;
ok ( GetMessageA ( & msg , hwnd , 0 , 0 ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 0 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
ok ( msg . lParam = = 0xbeef , " bad lparam %lx \n " , msg . lParam ) ;
time = msg . time ;
pt = msg . pt ;
ok ( time - GetTickCount ( ) < = 100 , " bad time %x \n " , msg . time ) ;
ok ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 1 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
ok ( msg . lParam = = 0xbeef , " bad lparam %lx \n " , msg . lParam ) ;
ok ( msg . time = = time , " bad time %x/%x \n " , msg . time , time ) ;
ok ( msg . pt . x = = pt . x & & msg . pt . y = = pt . y , " bad point %u,%u/%u,%u \n " , msg . pt . x , msg . pt . y , pt . x , pt . y ) ;
ok ( ! PeekMessageA ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
/* without PM_REMOVE */
PostMessageW ( hwnd , WM_CHAR , wch , 0 ) ;
ok ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 0 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
ok ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 0 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
ok ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 1 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
ok ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) , " no message \n " ) ;
ok ( msg . hwnd = = hwnd , " unexpected hwnd %p \n " , msg . hwnd ) ;
ok ( msg . message = = WM_CHAR , " unexpected message %x \n " , msg . message ) ;
ok ( msg . wParam = = dbch [ 1 ] , " bad wparam %lx/%x \n " , msg . wParam , dbch [ 0 ] ) ;
ok ( ! PeekMessageA ( & msg , hwnd , 0 , 0 , PM_REMOVE ) , " got message %x \n " , msg . message ) ;
2007-08-08 18:25:57 +02:00
DestroyWindow ( hwnd ) ;
}
2007-10-02 12:08:15 +02:00
# define ID_LISTBOX 0x000f
static const struct message wm_lb_setcursel_0 [ ] =
{
{ LB_SETCURSEL , sent | wparam | lparam , 0 , 0 } ,
{ WM_CTLCOLORLISTBOX , sent | parent } ,
2007-10-16 15:23:34 +02:00
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x000120f2 } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 1 } ,
{ EVENT_OBJECT_SELECTION , winevent_hook | wparam | lparam , OBJID_CLIENT , 1 } ,
2007-10-02 12:08:15 +02:00
{ 0 }
} ;
static const struct message wm_lb_setcursel_1 [ ] =
{
{ LB_SETCURSEL , sent | wparam | lparam , 1 , 0 } ,
{ WM_CTLCOLORLISTBOX , sent | parent } ,
2007-10-16 15:23:34 +02:00
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x000020f2 } ,
2007-10-02 12:08:15 +02:00
{ WM_CTLCOLORLISTBOX , sent | parent } ,
2007-10-16 15:23:34 +02:00
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x000121f2 } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 2 } ,
{ EVENT_OBJECT_SELECTION , winevent_hook | wparam | lparam , OBJID_CLIENT , 2 } ,
{ 0 }
} ;
static const struct message wm_lb_setcursel_2 [ ] =
{
{ LB_SETCURSEL , sent | wparam | lparam , 2 , 0 } ,
{ WM_CTLCOLORLISTBOX , sent | parent } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x000021f2 } ,
{ WM_CTLCOLORLISTBOX , sent | parent } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x000122f2 } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 3 } ,
{ EVENT_OBJECT_SELECTION , winevent_hook | wparam | lparam , OBJID_CLIENT , 3 } ,
{ 0 }
} ;
static const struct message wm_lb_click_0 [ ] =
{
{ WM_LBUTTONDOWN , sent | wparam | lparam , 0 , MAKELPARAM ( 1 , 1 ) } ,
{ HCBT_SETFOCUS , hook } ,
{ WM_KILLFOCUS , sent | parent } ,
{ WM_IME_SETCONTEXT , sent | wparam | optional | parent , 0 } ,
2008-07-31 17:16:22 +02:00
{ WM_IME_SETCONTEXT , sent | wparam | defwinproc | optional , 1 } ,
2007-10-16 15:23:34 +02:00
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 0 } ,
2008-03-27 15:40:57 +01:00
{ WM_SETFOCUS , sent | defwinproc } ,
2007-10-16 15:23:34 +02:00
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x001142f2 } ,
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_LISTBOX , LBN_SETFOCUS ) } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 3 } ,
{ WM_LBTRACKPOINT , sent | wparam | lparam | parent , 0 , MAKELPARAM ( 1 , 1 ) } ,
{ EVENT_SYSTEM_CAPTURESTART , winevent_hook | wparam | lparam , 0 , 0 } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x000142f2 } ,
{ WM_CTLCOLORLISTBOX , sent | parent } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x000022f2 } ,
{ WM_CTLCOLORLISTBOX , sent | parent } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x000120f2 } ,
{ WM_DRAWITEM , sent | wparam | lparam | parent , ID_LISTBOX , 0x001140f2 } ,
{ EVENT_OBJECT_FOCUS , winevent_hook | wparam | lparam , OBJID_CLIENT , 1 } ,
{ EVENT_OBJECT_SELECTION , winevent_hook | wparam | lparam , OBJID_CLIENT , 1 } ,
{ WM_LBUTTONUP , sent | wparam | lparam , 0 , 0 } ,
{ EVENT_SYSTEM_CAPTUREEND , winevent_hook | wparam | lparam , 0 , 0 } ,
2008-03-27 15:40:57 +01:00
{ WM_CAPTURECHANGED , sent | wparam | lparam | defwinproc , 0 , 0 } ,
2007-10-16 15:23:34 +02:00
{ WM_COMMAND , sent | wparam | parent , MAKEWPARAM ( ID_LISTBOX , LBN_SELCHANGE ) } ,
2007-10-02 12:08:15 +02:00
{ 0 }
} ;
2009-04-29 05:55:13 +02:00
static const struct message wm_lb_deletestring [ ] =
{
{ LB_DELETESTRING , sent | wparam | lparam , 0 , 0 } ,
2009-05-12 12:09:07 +02:00
{ WM_DELETEITEM , sent | wparam | parent | optional , ID_LISTBOX , 0 } ,
{ WM_DRAWITEM , sent | wparam | parent | optional , ID_LISTBOX } ,
{ WM_DRAWITEM , sent | wparam | parent | optional , ID_LISTBOX } ,
2009-04-29 05:55:13 +02:00
{ 0 }
} ;
static const struct message wm_lb_deletestring_reset [ ] =
{
{ LB_DELETESTRING , sent | wparam | lparam , 0 , 0 } ,
2009-05-12 12:09:07 +02:00
{ LB_RESETCONTENT , sent | wparam | lparam | defwinproc | optional , 0 , 0 } ,
{ WM_DELETEITEM , sent | wparam | parent | optional , ID_LISTBOX , 0 } ,
{ WM_DRAWITEM , sent | wparam | parent | optional , ID_LISTBOX } ,
{ WM_DRAWITEM , sent | wparam | parent | optional , ID_LISTBOX } ,
2009-04-29 05:55:13 +02:00
{ 0 }
} ;
2007-10-02 12:08:15 +02:00
# define check_lb_state(a1, a2, a3, a4, a5) check_lb_state_dbg(a1, a2, a3, a4, a5, __LINE__)
static LRESULT ( WINAPI * listbox_orig_proc ) ( HWND , UINT , WPARAM , LPARAM ) ;
static LRESULT WINAPI listbox_hook_proc ( HWND hwnd , UINT message , WPARAM wp , LPARAM lp )
{
2009-04-22 10:25:30 +02:00
static LONG defwndproc_counter = 0 ;
2008-03-27 07:35:59 +01:00
LRESULT ret ;
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2007-10-02 12:08:15 +02:00
/* do not log painting messages */
if ( message ! = WM_PAINT & &
message ! = WM_NCPAINT & &
message ! = WM_SYNCPAINT & &
message ! = WM_ERASEBKGND & &
message ! = WM_NCHITTEST & &
message ! = WM_GETTEXT & &
2009-05-12 12:09:30 +02:00
! ignore_message ( message ) )
2007-10-02 12:08:15 +02:00
{
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2007-10-02 12:08:15 +02:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
2008-03-27 15:40:57 +01:00
if ( defwndproc_counter ) msg . flags | = defwinproc ;
2007-10-02 12:08:15 +02:00
msg . wParam = wp ;
msg . lParam = lp ;
2009-01-12 21:03:57 +01:00
msg . descr = " listbox " ;
2007-10-02 12:08:15 +02:00
add_message ( & msg ) ;
}
2008-03-27 07:35:59 +01:00
defwndproc_counter + + ;
ret = CallWindowProcA ( listbox_orig_proc , hwnd , message , wp , lp ) ;
defwndproc_counter - - ;
return ret ;
2007-10-02 12:08:15 +02:00
}
static void check_lb_state_dbg ( HWND listbox , int count , int cur_sel ,
int caret_index , int top_index , int line )
{
LRESULT ret ;
2007-10-16 15:23:34 +02:00
/* calling an orig proc helps to avoid unnecessary message logging */
ret = CallWindowProcA ( listbox_orig_proc , listbox , LB_GETCOUNT , 0 , 0 ) ;
2007-10-02 12:08:15 +02:00
ok_ ( __FILE__ , line ) ( ret = = count , " expected count %d, got %ld \n " , count , ret ) ;
2007-10-16 15:23:34 +02:00
ret = CallWindowProcA ( listbox_orig_proc , listbox , LB_GETCURSEL , 0 , 0 ) ;
2007-10-02 12:08:15 +02:00
ok_ ( __FILE__ , line ) ( ret = = cur_sel , " expected cur sel %d, got %ld \n " , cur_sel , ret ) ;
2007-10-16 15:23:34 +02:00
ret = CallWindowProcA ( listbox_orig_proc , listbox , LB_GETCARETINDEX , 0 , 0 ) ;
2009-06-02 11:56:42 +02:00
ok_ ( __FILE__ , line ) ( ret = = caret_index | |
broken ( cur_sel = = - 1 & & caret_index = = 0 & & ret = = - 1 ) , /* nt4 */
" expected caret index %d, got %ld \n " , caret_index , ret ) ;
2007-10-16 15:23:34 +02:00
ret = CallWindowProcA ( listbox_orig_proc , listbox , LB_GETTOPINDEX , 0 , 0 ) ;
2007-10-02 12:08:15 +02:00
ok_ ( __FILE__ , line ) ( ret = = top_index , " expected top index %d, got %ld \n " , top_index , ret ) ;
}
2008-03-27 07:35:59 +01:00
static void test_listbox_messages ( void )
2007-10-02 12:08:15 +02:00
{
HWND parent , listbox ;
LRESULT ret ;
parent = CreateWindowExA ( 0 , " TestParentClass " , NULL , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
listbox = CreateWindowExA ( WS_EX_NOPARENTNOTIFY , " ListBox " , NULL ,
WS_CHILD | LBS_NOTIFY | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | WS_VISIBLE ,
2007-10-16 15:23:34 +02:00
10 , 10 , 80 , 80 , parent , ( HMENU ) ID_LISTBOX , 0 , NULL ) ;
2007-10-02 12:08:15 +02:00
listbox_orig_proc = ( WNDPROC ) SetWindowLongPtrA ( listbox , GWLP_WNDPROC , ( ULONG_PTR ) listbox_hook_proc ) ;
check_lb_state ( listbox , 0 , LB_ERR , 0 , 0 ) ;
2007-10-16 15:23:34 +02:00
ret = SendMessage ( listbox , LB_ADDSTRING , 0 , ( LPARAM ) " item 0 " ) ;
2007-10-02 12:08:15 +02:00
ok ( ret = = 0 , " expected 0, got %ld \n " , ret ) ;
2007-10-16 15:23:34 +02:00
ret = SendMessage ( listbox , LB_ADDSTRING , 0 , ( LPARAM ) " item 1 " ) ;
2007-10-02 12:08:15 +02:00
ok ( ret = = 1 , " expected 1, got %ld \n " , ret ) ;
2007-10-16 15:23:34 +02:00
ret = SendMessage ( listbox , LB_ADDSTRING , 0 , ( LPARAM ) " item 2 " ) ;
2007-10-02 12:08:15 +02:00
ok ( ret = = 2 , " expected 2, got %ld \n " , ret ) ;
check_lb_state ( listbox , 3 , LB_ERR , 0 , 0 ) ;
flush_sequence ( ) ;
log_all_parent_messages + + ;
trace ( " selecting item 0 \n " ) ;
2007-10-16 15:23:34 +02:00
ret = SendMessage ( listbox , LB_SETCURSEL , 0 , 0 ) ;
ok ( ret = = 0 , " expected 0, got %ld \n " , ret ) ;
2007-10-02 12:08:15 +02:00
ok_sequence ( wm_lb_setcursel_0 , " LB_SETCURSEL 0 " , FALSE ) ;
check_lb_state ( listbox , 3 , 0 , 0 , 0 ) ;
flush_sequence ( ) ;
trace ( " selecting item 1 \n " ) ;
2007-10-16 15:23:34 +02:00
ret = SendMessage ( listbox , LB_SETCURSEL , 1 , 0 ) ;
ok ( ret = = 1 , " expected 1, got %ld \n " , ret ) ;
2007-10-02 12:08:15 +02:00
ok_sequence ( wm_lb_setcursel_1 , " LB_SETCURSEL 1 " , FALSE ) ;
check_lb_state ( listbox , 3 , 1 , 1 , 0 ) ;
2007-10-16 15:23:34 +02:00
trace ( " selecting item 2 \n " ) ;
ret = SendMessage ( listbox , LB_SETCURSEL , 2 , 0 ) ;
ok ( ret = = 2 , " expected 2, got %ld \n " , ret ) ;
ok_sequence ( wm_lb_setcursel_2 , " LB_SETCURSEL 2 " , FALSE ) ;
check_lb_state ( listbox , 3 , 2 , 2 , 0 ) ;
trace ( " clicking on item 0 \n " ) ;
ret = SendMessage ( listbox , WM_LBUTTONDOWN , 0 , MAKELPARAM ( 1 , 1 ) ) ;
ok ( ret = = LB_OKAY , " expected LB_OKAY, got %ld \n " , ret ) ;
ret = SendMessage ( listbox , WM_LBUTTONUP , 0 , 0 ) ;
ok ( ret = = LB_OKAY , " expected LB_OKAY, got %ld \n " , ret ) ;
ok_sequence ( wm_lb_click_0 , " WM_LBUTTONDOWN 0 " , FALSE ) ;
check_lb_state ( listbox , 3 , 0 , 0 , 0 ) ;
flush_sequence ( ) ;
2009-04-29 05:55:13 +02:00
trace ( " deleting item 0 \n " ) ;
ret = SendMessage ( listbox , LB_DELETESTRING , 0 , 0 ) ;
ok ( ret = = 2 , " expected 2, got %ld \n " , ret ) ;
ok_sequence ( wm_lb_deletestring , " LB_DELETESTRING 0 " , FALSE ) ;
check_lb_state ( listbox , 2 , - 1 , 0 , 0 ) ;
flush_sequence ( ) ;
trace ( " deleting item 0 \n " ) ;
ret = SendMessage ( listbox , LB_DELETESTRING , 0 , 0 ) ;
ok ( ret = = 1 , " expected 1, got %ld \n " , ret ) ;
ok_sequence ( wm_lb_deletestring , " LB_DELETESTRING 0 " , FALSE ) ;
check_lb_state ( listbox , 1 , - 1 , 0 , 0 ) ;
flush_sequence ( ) ;
trace ( " deleting item 0 \n " ) ;
ret = SendMessage ( listbox , LB_DELETESTRING , 0 , 0 ) ;
ok ( ret = = 0 , " expected 0, got %ld \n " , ret ) ;
ok_sequence ( wm_lb_deletestring_reset , " LB_DELETESTRING 0 " , FALSE ) ;
check_lb_state ( listbox , 0 , - 1 , 0 , 0 ) ;
flush_sequence ( ) ;
trace ( " deleting item 0 \n " ) ;
ret = SendMessage ( listbox , LB_DELETESTRING , 0 , 0 ) ;
ok ( ret = = LB_ERR , " expected LB_ERR, got %ld \n " , ret ) ;
check_lb_state ( listbox , 0 , - 1 , 0 , 0 ) ;
flush_sequence ( ) ;
2007-10-02 12:08:15 +02:00
log_all_parent_messages - - ;
2008-03-27 07:35:59 +01:00
DestroyWindow ( listbox ) ;
2007-10-02 12:08:15 +02:00
DestroyWindow ( parent ) ;
}
2008-06-18 05:34:01 +02:00
/*************************** Menu test ******************************/
static const struct message wm_popup_menu_1 [ ] =
{
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , VK_MENU , 0x20000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' E ' , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , ' E ' , 0x20000001 } ,
{ WM_SYSCHAR , sent | wparam | lparam , ' e ' , 0x20000001 } ,
{ HCBT_SYSCOMMAND , hook | wparam | lparam , SC_KEYMENU , ' e ' } ,
{ WM_ENTERMENULOOP , sent | wparam | lparam , 0 , 0 } ,
{ WM_INITMENU , sent | lparam , 0 , 0 } ,
{ WM_MENUSELECT , sent | wparam , MAKEWPARAM ( 1 , MF_HILITE | MF_POPUP ) } ,
{ WM_INITMENUPOPUP , sent | lparam , 0 , 1 } ,
{ HCBT_CREATEWND , hook | optional } , /* Win9x doesn't create a window */
{ WM_MENUSELECT , sent | wparam , MAKEWPARAM ( 200 , MF_HILITE ) } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' E ' , 0xf0000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0xd0000001 } ,
2010-06-17 13:37:42 +02:00
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RETURN , 0x10000001 , 0 , 0x40000000 } ,
2008-06-18 05:34:01 +02:00
{ HCBT_DESTROYWND , hook | optional } , /* Win9x doesn't create a window */
{ WM_UNINITMENUPOPUP , sent | lparam , 0 , 0 } ,
{ WM_MENUSELECT , sent | wparam | lparam , MAKEWPARAM ( 0 , 0xffff ) , 0 } ,
{ WM_EXITMENULOOP , sent | wparam | lparam , 0 , 0 } ,
{ WM_MENUCOMMAND , sent } , /* |wparam, 200 - Win9x */
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RETURN , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_RETURN , 0xc0000001 } ,
{ 0 }
} ;
static const struct message wm_popup_menu_2 [ ] =
{
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , VK_MENU , 0x20000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' F ' , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , ' F ' , 0x20000001 } ,
{ WM_SYSCHAR , sent | wparam | lparam , ' f ' , 0x20000001 } ,
{ HCBT_SYSCOMMAND , hook | wparam | lparam , SC_KEYMENU , ' f ' } ,
{ WM_ENTERMENULOOP , sent | wparam | lparam , 0 , 0 } ,
{ WM_INITMENU , sent | lparam , 0 , 0 } ,
{ WM_MENUSELECT , sent | wparam , MAKEWPARAM ( 0 , MF_HILITE | MF_POPUP ) } ,
{ WM_INITMENUPOPUP , sent | lparam , 0 , 0 } ,
{ WM_MENUSELECT , sent | wparam | optional , MAKEWPARAM ( 0 , MF_HILITE | MF_POPUP ) } , /* Win9x */
{ WM_INITMENUPOPUP , sent | lparam | optional , 0 , 0 } , /* Win9x */
{ HCBT_CREATEWND , hook } ,
{ WM_MENUSELECT , sent } , /*|wparam, MAKEWPARAM(0,MF_HILITE|MF_POPUP) - XP
| wparam , MAKEWPARAM ( 100 , MF_HILITE ) - Win9x */
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' F ' , 0xf0000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0xd0000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RIGHT , 0x10000001 } ,
{ WM_INITMENUPOPUP , sent | lparam | optional , 0 , 0 } , /* Win9x doesn't send it */
{ HCBT_CREATEWND , hook | optional } , /* Win9x doesn't send it */
{ WM_MENUSELECT , sent | wparam | optional , MAKEWPARAM ( 100 , MF_HILITE ) } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RIGHT , 0xd0000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RETURN , 0x10000001 } ,
{ HCBT_DESTROYWND , hook } ,
{ WM_UNINITMENUPOPUP , sent | lparam , 0 , 0 } ,
{ HCBT_DESTROYWND , hook | optional } , /* Win9x doesn't send it */
{ WM_UNINITMENUPOPUP , sent | lparam , 0 , 0 } ,
{ WM_MENUSELECT , sent | wparam | lparam , MAKEWPARAM ( 0 , 0xffff ) , 0 } ,
{ WM_EXITMENULOOP , sent | wparam | lparam , 0 , 0 } ,
{ WM_MENUCOMMAND , sent } , /* |wparam, 100 - Win9x */
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RETURN , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_RETURN , 0xc0000001 } ,
{ 0 }
} ;
static const struct message wm_popup_menu_3 [ ] =
{
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , VK_MENU , 0x20000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' F ' , 0x20000001 } ,
{ WM_SYSKEYDOWN , sent | wparam | lparam , ' F ' , 0x20000001 } ,
{ WM_SYSCHAR , sent | wparam | lparam , ' f ' , 0x20000001 } ,
{ HCBT_SYSCOMMAND , hook | wparam | lparam , SC_KEYMENU , ' f ' } ,
{ WM_ENTERMENULOOP , sent | wparam | lparam , 0 , 0 } ,
{ WM_INITMENU , sent | lparam , 0 , 0 } ,
{ WM_MENUSELECT , sent | wparam , MAKEWPARAM ( 0 , MF_HILITE | MF_POPUP ) } ,
{ WM_INITMENUPOPUP , sent | lparam , 0 , 0 } ,
{ WM_MENUSELECT , sent | wparam | optional , MAKEWPARAM ( 0 , MF_HILITE | MF_POPUP ) } , /* Win9x */
{ WM_INITMENUPOPUP , sent | lparam | optional , 0 , 0 } , /* Win9x */
{ HCBT_CREATEWND , hook } ,
{ WM_MENUSELECT , sent } , /*|wparam, MAKEWPARAM(0,MF_HILITE|MF_POPUP) - XP
| wparam , MAKEWPARAM ( 100 , MF_HILITE ) - Win9x */
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , ' F ' , 0xf0000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_MENU , 0xd0000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RIGHT , 0x10000001 } ,
{ WM_INITMENUPOPUP , sent | lparam | optional , 0 , 0 } , /* Win9x doesn't send it */
{ HCBT_CREATEWND , hook | optional } , /* Win9x doesn't send it */
{ WM_MENUSELECT , sent | wparam | optional , MAKEWPARAM ( 100 , MF_HILITE ) } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RIGHT , 0xd0000001 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RETURN , 0x10000001 } ,
{ HCBT_DESTROYWND , hook } ,
{ WM_UNINITMENUPOPUP , sent | lparam , 0 , 0 } ,
{ HCBT_DESTROYWND , hook | optional } , /* Win9x doesn't send it */
{ WM_UNINITMENUPOPUP , sent | lparam , 0 , 0 } ,
{ WM_MENUSELECT , sent | wparam | lparam , MAKEWPARAM ( 0 , 0xffff ) , 0 } ,
{ WM_EXITMENULOOP , sent | wparam | lparam , 0 , 0 } ,
{ WM_COMMAND , sent | wparam | lparam , 100 , 0 } ,
{ HCBT_KEYSKIPPED , hook | wparam | lparam | optional , VK_RETURN , 0xc0000001 } ,
{ WM_KEYUP , sent | wparam | lparam , VK_RETURN , 0xc0000001 } ,
{ 0 }
} ;
static LRESULT WINAPI parent_menu_proc ( HWND hwnd , UINT message , WPARAM wp , LPARAM lp )
{
if ( message = = WM_ENTERIDLE | |
message = = WM_INITMENU | |
message = = WM_INITMENUPOPUP | |
message = = WM_MENUSELECT | |
message = = WM_PARENTNOTIFY | |
message = = WM_ENTERMENULOOP | |
message = = WM_EXITMENULOOP | |
message = = WM_UNINITMENUPOPUP | |
message = = WM_KEYDOWN | |
message = = WM_KEYUP | |
message = = WM_CHAR | |
message = = WM_SYSKEYDOWN | |
message = = WM_SYSKEYUP | |
message = = WM_SYSCHAR | |
message = = WM_COMMAND | |
message = = WM_MENUCOMMAND )
{
2009-01-12 21:03:57 +01:00
struct recvd_message msg ;
2008-06-18 05:34:01 +02:00
2009-01-12 21:03:57 +01:00
msg . hwnd = hwnd ;
2008-06-18 05:34:01 +02:00
msg . message = message ;
msg . flags = sent | wparam | lparam ;
msg . wParam = wp ;
msg . lParam = lp ;
2009-01-12 21:03:57 +01:00
msg . descr = " parent_menu_proc " ;
2008-06-18 05:34:01 +02:00
add_message ( & msg ) ;
}
return DefWindowProcA ( hwnd , message , wp , lp ) ;
}
static void set_menu_style ( HMENU hmenu , DWORD style )
{
MENUINFO mi ;
BOOL ret ;
mi . cbSize = sizeof ( mi ) ;
mi . fMask = MIM_STYLE ;
mi . dwStyle = style ;
SetLastError ( 0xdeadbeef ) ;
2008-06-20 17:07:33 +02:00
ret = pSetMenuInfo ( hmenu , & mi ) ;
2008-06-18 05:34:01 +02:00
ok ( ret , " SetMenuInfo error %u \n " , GetLastError ( ) ) ;
}
static DWORD get_menu_style ( HMENU hmenu )
{
MENUINFO mi ;
BOOL ret ;
mi . cbSize = sizeof ( mi ) ;
mi . fMask = MIM_STYLE ;
mi . dwStyle = 0 ;
SetLastError ( 0xdeadbeef ) ;
2008-06-20 17:07:33 +02:00
ret = pGetMenuInfo ( hmenu , & mi ) ;
2008-06-18 05:34:01 +02:00
ok ( ret , " GetMenuInfo error %u \n " , GetLastError ( ) ) ;
return mi . dwStyle ;
}
static void test_menu_messages ( void )
{
MSG msg ;
WNDCLASSA cls ;
HMENU hmenu , hmenu_popup ;
HWND hwnd ;
DWORD style ;
2008-06-20 17:07:33 +02:00
if ( ! pGetMenuInfo | | ! pSetMenuInfo )
{
2009-02-23 10:41:03 +01:00
win_skip ( " GetMenuInfo and/or SetMenuInfo are not available \n " ) ;
2008-06-20 17:07:33 +02:00
return ;
}
2008-06-18 05:34:01 +02:00
cls . style = 0 ;
cls . lpfnWndProc = parent_menu_proc ;
cls . cbClsExtra = 0 ;
cls . cbWndExtra = 0 ;
cls . hInstance = GetModuleHandleA ( 0 ) ;
cls . hIcon = 0 ;
2009-01-13 10:55:46 +01:00
cls . hCursor = LoadCursorA ( 0 , IDC_ARROW ) ;
2008-06-18 05:34:01 +02:00
cls . hbrBackground = GetStockObject ( WHITE_BRUSH ) ;
cls . lpszMenuName = NULL ;
cls . lpszClassName = " TestMenuClass " ;
UnregisterClass ( cls . lpszClassName , cls . hInstance ) ;
if ( ! RegisterClassA ( & cls ) ) assert ( 0 ) ;
SetLastError ( 0xdeadbeef ) ;
hwnd = CreateWindowExA ( 0 , " TestMenuClass " , NULL , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
100 , 100 , 200 , 200 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " LoadMenuA error %u \n " , GetLastError ( ) ) ;
SetLastError ( 0xdeadbeef ) ;
hmenu = LoadMenuA ( GetModuleHandle ( 0 ) , MAKEINTRESOURCE ( 1 ) ) ;
ok ( hmenu ! = 0 , " LoadMenuA error %u \n " , GetLastError ( ) ) ;
SetMenu ( hwnd , hmenu ) ;
2008-07-31 17:16:22 +02:00
SetForegroundWindow ( hwnd ) ;
2008-06-18 05:34:01 +02:00
set_menu_style ( hmenu , MNS_NOTIFYBYPOS ) ;
style = get_menu_style ( hmenu ) ;
ok ( style = = MNS_NOTIFYBYPOS , " expected MNS_NOTIFYBYPOS, got %u \n " , style ) ;
hmenu_popup = GetSubMenu ( hmenu , 0 ) ;
ok ( hmenu_popup ! = 0 , " GetSubMenu returned 0 for submenu 0 \n " ) ;
style = get_menu_style ( hmenu_popup ) ;
ok ( style = = 0 , " expected 0, got %u \n " , style ) ;
hmenu_popup = GetSubMenu ( hmenu_popup , 0 ) ;
ok ( hmenu_popup ! = 0 , " GetSubMenu returned 0 for submenu 0 \n " ) ;
style = get_menu_style ( hmenu_popup ) ;
ok ( style = = 0 , " expected 0, got %u \n " , style ) ;
/* Alt+E, Enter */
trace ( " testing a popup menu command \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
keybd_event ( ' E ' , 0 , 0 , 0 ) ;
keybd_event ( ' E ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_RETURN , 0 , 0 , 0 ) ;
keybd_event ( VK_RETURN , 0 , KEYEVENTF_KEYUP , 0 ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
2009-02-20 16:56:16 +01:00
if ( ! sequence_cnt ) /* we didn't get any message */
{
skip ( " queuing key events not supported \n " ) ;
goto done ;
}
2009-03-09 17:54:16 +01:00
/* win98 queues only a WM_KEYUP and doesn't start menu tracking */
if ( sequence [ 0 ] . message = = WM_KEYUP & & sequence [ 0 ] . wParam = = VK_MENU )
{
win_skip ( " menu tracking through VK_MENU not supported \n " ) ;
goto done ;
}
2008-06-18 05:34:01 +02:00
ok_sequence ( wm_popup_menu_1 , " popup menu command " , FALSE ) ;
/* Alt+F, Right, Enter */
trace ( " testing submenu of a popup menu command \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
keybd_event ( ' F ' , 0 , 0 , 0 ) ;
keybd_event ( ' F ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_RIGHT , 0 , 0 , 0 ) ;
keybd_event ( VK_RIGHT , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_RETURN , 0 , 0 , 0 ) ;
keybd_event ( VK_RETURN , 0 , KEYEVENTF_KEYUP , 0 ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
ok_sequence ( wm_popup_menu_2 , " submenu of a popup menu command " , FALSE ) ;
set_menu_style ( hmenu , 0 ) ;
style = get_menu_style ( hmenu ) ;
2008-06-19 17:11:19 +02:00
ok ( style = = 0 , " expected 0, got %u \n " , style ) ;
2008-06-18 05:34:01 +02:00
hmenu_popup = GetSubMenu ( hmenu , 0 ) ;
ok ( hmenu_popup ! = 0 , " GetSubMenu returned 0 for submenu 0 \n " ) ;
set_menu_style ( hmenu_popup , MNS_NOTIFYBYPOS ) ;
style = get_menu_style ( hmenu_popup ) ;
ok ( style = = MNS_NOTIFYBYPOS , " expected MNS_NOTIFYBYPOS, got %u \n " , style ) ;
hmenu_popup = GetSubMenu ( hmenu_popup , 0 ) ;
ok ( hmenu_popup ! = 0 , " GetSubMenu returned 0 for submenu 0 \n " ) ;
style = get_menu_style ( hmenu_popup ) ;
ok ( style = = 0 , " expected 0, got %u \n " , style ) ;
/* Alt+F, Right, Enter */
trace ( " testing submenu of a popup menu command \n " ) ;
flush_sequence ( ) ;
keybd_event ( VK_MENU , 0 , 0 , 0 ) ;
keybd_event ( ' F ' , 0 , 0 , 0 ) ;
keybd_event ( ' F ' , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_MENU , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_RIGHT , 0 , 0 , 0 ) ;
keybd_event ( VK_RIGHT , 0 , KEYEVENTF_KEYUP , 0 ) ;
keybd_event ( VK_RETURN , 0 , 0 , 0 ) ;
keybd_event ( VK_RETURN , 0 , KEYEVENTF_KEYUP , 0 ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
ok_sequence ( wm_popup_menu_3 , " submenu of a popup menu command " , FALSE ) ;
2009-02-20 16:56:16 +01:00
done :
2008-06-18 05:34:01 +02:00
DestroyWindow ( hwnd ) ;
DestroyMenu ( hmenu ) ;
}
2008-08-26 16:55:05 +02:00
static void test_paintingloop ( void )
{
HWND hwnd ;
paint_loop_done = 0 ;
hwnd = CreateWindowExA ( 0x0 , " PaintLoopWindowClass " ,
" PaintLoopWindowClass " , WS_OVERLAPPEDWINDOW ,
100 , 100 , 100 , 100 , 0 , 0 , 0 , NULL ) ;
ok ( hwnd ! = 0 , " PaintLoop window error %u \n " , GetLastError ( ) ) ;
ShowWindow ( hwnd , SW_NORMAL ) ;
SetFocus ( hwnd ) ;
while ( ! paint_loop_done )
{
MSG msg ;
if ( PeekMessageA ( & msg , 0 , 0 , 0 , 1 ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
}
DestroyWindow ( hwnd ) ;
}
2009-02-18 07:49:15 +01:00
static void test_defwinproc ( void )
{
HWND hwnd ;
MSG msg ;
int gotwmquit = FALSE ;
hwnd = CreateWindowExA ( 0 , " static " , " test_defwndproc " , WS_POPUP , 0 , 0 , 0 , 0 , 0 , 0 , 0 , NULL ) ;
assert ( hwnd ) ;
DefWindowProcA ( hwnd , WM_ENDSESSION , 1 , 0 ) ;
while ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) {
if ( msg . message = = WM_QUIT ) gotwmquit = TRUE ;
DispatchMessageA ( & msg ) ;
}
ok ( gotwmquit = = FALSE , " Unexpected WM_QUIT message! \n " ) ;
DestroyWindow ( hwnd ) ;
}
2009-09-20 00:29:44 +02:00
# define clear_clipboard(hwnd) clear_clipboard_(__LINE__, (hwnd))
static void clear_clipboard_ ( int line , HWND hWnd )
{
BOOL succ ;
succ = OpenClipboard ( hWnd ) ;
ok_ ( __FILE__ , line ) ( succ , " OpenClipboard failed, err=%u \n " , GetLastError ( ) ) ;
succ = EmptyClipboard ( ) ;
ok_ ( __FILE__ , line ) ( succ , " EmptyClipboard failed, err=%u \n " , GetLastError ( ) ) ;
succ = CloseClipboard ( ) ;
ok_ ( __FILE__ , line ) ( succ , " CloseClipboard failed, err=%u \n " , GetLastError ( ) ) ;
}
# define expect_HWND(expected, got) expect_HWND_(__LINE__, (expected), (got))
static void expect_HWND_ ( int line , HWND expected , HWND got )
{
ok_ ( __FILE__ , line ) ( got = = expected , " Expected %p, got %p \n " , expected , got ) ;
}
static WNDPROC pOldViewerProc ;
static LRESULT CALLBACK recursive_viewer_proc ( HWND hWnd , UINT message , WPARAM wParam , LPARAM lParam )
{
static BOOL recursion_guard ;
if ( message = = WM_DRAWCLIPBOARD & & ! recursion_guard )
{
recursion_guard = TRUE ;
clear_clipboard ( hWnd ) ;
recursion_guard = FALSE ;
}
return CallWindowProcA ( pOldViewerProc , hWnd , message , wParam , lParam ) ;
}
static void test_clipboard_viewers ( void )
{
static struct message wm_change_cb_chain [ ] =
{
{ WM_CHANGECBCHAIN , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static const struct message wm_clipboard_destroyed [ ] =
{
{ WM_DESTROYCLIPBOARD , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static struct message wm_clipboard_changed [ ] =
{
{ WM_DRAWCLIPBOARD , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
static struct message wm_clipboard_changed_and_owned [ ] =
{
{ WM_DESTROYCLIPBOARD , sent | wparam | lparam , 0 , 0 } ,
{ WM_DRAWCLIPBOARD , sent | wparam | lparam , 0 , 0 } ,
{ 0 }
} ;
HINSTANCE hInst = GetModuleHandleA ( NULL ) ;
HWND hWnd1 , hWnd2 , hWnd3 ;
HWND hOrigViewer ;
HWND hRet ;
hWnd1 = CreateWindowExA ( 0 , " TestWindowClass " , " Clipboard viewer test wnd 1 " ,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX ,
CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT ,
GetDesktopWindow ( ) , NULL , hInst , NULL ) ;
hWnd2 = CreateWindowExA ( 0 , " SimpleWindowClass " , " Clipboard viewer test wnd 2 " ,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX ,
CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT ,
GetDesktopWindow ( ) , NULL , hInst , NULL ) ;
hWnd3 = CreateWindowExA ( 0 , " SimpleWindowClass " , " Clipboard viewer test wnd 3 " ,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX ,
CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT ,
GetDesktopWindow ( ) , NULL , hInst , NULL ) ;
trace ( " clipbd viewers: hWnd1=%p, hWnd2=%p, hWnd3=%p \n " , hWnd1 , hWnd2 , hWnd3 ) ;
assert ( hWnd1 & & hWnd2 & & hWnd3 ) ;
flush_sequence ( ) ;
/* Test getting the clipboard viewer and setting the viewer to NULL. */
hOrigViewer = GetClipboardViewer ( ) ;
hRet = SetClipboardViewer ( NULL ) ;
ok_sequence ( WmEmptySeq , " set viewer to NULL " , FALSE ) ;
expect_HWND ( hOrigViewer , hRet ) ;
expect_HWND ( NULL , GetClipboardViewer ( ) ) ;
/* Test registering hWnd1 as a viewer. */
hRet = SetClipboardViewer ( hWnd1 ) ;
wm_clipboard_changed [ 0 ] . wParam = ( WPARAM ) GetClipboardOwner ( ) ;
2009-09-23 02:35:57 +02:00
ok_sequence ( wm_clipboard_changed , " set viewer NULL->1 " , FALSE ) ;
2009-09-20 00:29:44 +02:00
expect_HWND ( NULL , hRet ) ;
expect_HWND ( hWnd1 , GetClipboardViewer ( ) ) ;
/* Test that changing the clipboard actually refreshes the registered viewer. */
clear_clipboard ( hWnd1 ) ;
wm_clipboard_changed [ 0 ] . wParam = ( WPARAM ) GetClipboardOwner ( ) ;
2009-09-23 02:30:28 +02:00
ok_sequence ( wm_clipboard_changed , " clear clipbd (viewer=owner=1) " , FALSE ) ;
2009-09-20 00:29:44 +02:00
/* Again, but with different owner. */
clear_clipboard ( hWnd2 ) ;
wm_clipboard_changed_and_owned [ 1 ] . wParam = ( WPARAM ) GetClipboardOwner ( ) ;
2009-09-23 02:30:28 +02:00
ok_sequence ( wm_clipboard_changed_and_owned , " clear clipbd (viewer=1, owner=2) " , FALSE ) ;
2009-09-20 00:29:44 +02:00
/* Test re-registering same window. */
hRet = SetClipboardViewer ( hWnd1 ) ;
wm_clipboard_changed [ 0 ] . wParam = ( WPARAM ) GetClipboardOwner ( ) ;
2009-09-23 02:35:57 +02:00
ok_sequence ( wm_clipboard_changed , " set viewer 1->1 " , FALSE ) ;
2009-09-20 00:29:44 +02:00
expect_HWND ( hWnd1 , hRet ) ;
expect_HWND ( hWnd1 , GetClipboardViewer ( ) ) ;
/* Test ChangeClipboardChain. */
ChangeClipboardChain ( hWnd2 , hWnd3 ) ;
wm_change_cb_chain [ 0 ] . wParam = ( WPARAM ) hWnd2 ;
wm_change_cb_chain [ 0 ] . lParam = ( LPARAM ) hWnd3 ;
ok_sequence ( wm_change_cb_chain , " change chain (viewer=1, remove=2, next=3) " , FALSE ) ;
expect_HWND ( hWnd1 , GetClipboardViewer ( ) ) ;
ChangeClipboardChain ( hWnd2 , NULL ) ;
wm_change_cb_chain [ 0 ] . wParam = ( WPARAM ) hWnd2 ;
wm_change_cb_chain [ 0 ] . lParam = 0 ;
ok_sequence ( wm_change_cb_chain , " change chain (viewer=1, remove=2, next=NULL) " , FALSE ) ;
expect_HWND ( hWnd1 , GetClipboardViewer ( ) ) ;
ChangeClipboardChain ( NULL , hWnd2 ) ;
ok_sequence ( WmEmptySeq , " change chain (viewer=1, remove=NULL, next=2) " , TRUE ) ;
expect_HWND ( hWnd1 , GetClipboardViewer ( ) ) ;
/* Actually change clipboard viewer with ChangeClipboardChain. */
ChangeClipboardChain ( hWnd1 , hWnd2 ) ;
ok_sequence ( WmEmptySeq , " change chain (viewer=remove=1, next=2) " , FALSE ) ;
expect_HWND ( hWnd2 , GetClipboardViewer ( ) ) ;
/* Test that no refresh messages are sent when viewer has unregistered. */
clear_clipboard ( hWnd2 ) ;
ok_sequence ( WmEmptySeq , " clear clipd (viewer=2, owner=1) " , FALSE ) ;
/* Register hWnd1 again. */
ChangeClipboardChain ( hWnd2 , hWnd1 ) ;
ok_sequence ( WmEmptySeq , " change chain (viewer=remove=2, next=1) " , FALSE ) ;
expect_HWND ( hWnd1 , GetClipboardViewer ( ) ) ;
/* Subclass hWnd1 so that when it receives a WM_DRAWCLIPBOARD message, it
* changes the clipboard . When this happens , the system shouldn ' t send
* another WM_DRAWCLIPBOARD ( as this could cause an infinite loop ) .
*/
pOldViewerProc = ( WNDPROC ) SetWindowLongPtrA ( hWnd1 , GWLP_WNDPROC , ( LONG_PTR ) recursive_viewer_proc ) ;
clear_clipboard ( hWnd2 ) ;
/* The clipboard owner is changed in recursive_viewer_proc: */
wm_clipboard_changed [ 0 ] . wParam = ( WPARAM ) hWnd2 ;
ok_sequence ( wm_clipboard_changed , " recursive clear clipbd (viewer=1, owner=2) " , TRUE ) ;
/* Test unregistering. */
ChangeClipboardChain ( hWnd1 , NULL ) ;
ok_sequence ( WmEmptySeq , " change chain (viewer=remove=1, next=NULL) " , FALSE ) ;
expect_HWND ( NULL , GetClipboardViewer ( ) ) ;
clear_clipboard ( hWnd1 ) ;
ok_sequence ( wm_clipboard_destroyed , " clear clipbd (no viewer, owner=1) " , FALSE ) ;
DestroyWindow ( hWnd1 ) ;
DestroyWindow ( hWnd2 ) ;
DestroyWindow ( hWnd3 ) ;
SetClipboardViewer ( hOrigViewer ) ;
}
2009-06-11 14:49:31 +02:00
static void test_PostMessage ( void )
{
static const struct
{
HWND hwnd ;
BOOL ret ;
} data [ ] =
{
{ HWND_TOP /* 0 */ , TRUE } ,
{ HWND_BROADCAST , TRUE } ,
{ HWND_BOTTOM , TRUE } ,
{ HWND_TOPMOST , TRUE } ,
{ HWND_NOTOPMOST , FALSE } ,
{ HWND_MESSAGE , FALSE } ,
{ ( HWND ) 0xdeadbeef , FALSE }
} ;
int i ;
HWND hwnd ;
BOOL ret ;
MSG msg ;
2009-06-13 14:28:29 +02:00
static const WCHAR staticW [ ] = { ' s ' , ' t ' , ' a ' , ' t ' , ' i ' , ' c ' , 0 } ;
2009-06-11 14:49:31 +02:00
2009-06-13 14:28:29 +02:00
SetLastError ( 0xdeadbeef ) ;
hwnd = CreateWindowExW ( 0 , staticW , NULL , WS_POPUP , 0 , 0 , 0 , 0 , 0 , 0 , 0 , NULL ) ;
if ( ! hwnd & & GetLastError ( ) = = ERROR_CALL_NOT_IMPLEMENTED )
{
win_skip ( " Skipping some PostMessage tests on Win9x/WinMe \n " ) ;
return ;
}
2009-06-11 14:49:31 +02:00
assert ( hwnd ) ;
flush_events ( ) ;
PostMessage ( hwnd , WM_USER + 1 , 0x1234 , 0x5678 ) ;
PostMessage ( 0 , WM_USER + 2 , 0x5678 , 0x1234 ) ;
for ( i = 0 ; i < sizeof ( data ) / sizeof ( data [ 0 ] ) ; i + + )
{
memset ( & msg , 0xab , sizeof ( msg ) ) ;
ret = PeekMessageA ( & msg , data [ i ] . hwnd , 0 , 0 , PM_NOREMOVE ) ;
ok ( ret = = data [ i ] . ret , " %d: hwnd %p expected %d, got %d \n " , i , data [ i ] . hwnd , data [ i ] . ret , ret ) ;
if ( data [ i ] . ret )
{
if ( data [ i ] . hwnd )
ok ( ret & & msg . hwnd = = 0 & & msg . message = = WM_USER + 2 & &
msg . wParam = = 0x5678 & & msg . lParam = = 0x1234 ,
2009-06-13 14:28:29 +02:00
" %d: got ret %d hwnd %p msg %04x wParam %08lx lParam %08lx instead of TRUE/0/WM_USER+2/0x5678/0x1234 \n " ,
i , ret , msg . hwnd , msg . message , msg . wParam , msg . lParam ) ;
2009-06-11 14:49:31 +02:00
else
ok ( ret & & msg . hwnd = = hwnd & & msg . message = = WM_USER + 1 & &
msg . wParam = = 0x1234 & & msg . lParam = = 0x5678 ,
2009-06-13 14:28:29 +02:00
" %d: got ret %d hwnd %p msg %04x wParam %08lx lParam %08lx instead of TRUE/%p/WM_USER+1/0x1234/0x5678 \n " ,
i , ret , msg . hwnd , msg . message , msg . wParam , msg . lParam , msg . hwnd ) ;
2009-06-11 14:49:31 +02:00
}
}
DestroyWindow ( hwnd ) ;
flush_events ( ) ;
}
2009-12-15 13:10:53 +01:00
static const struct
{
DWORD exp , broken ;
BOOL todo ;
} wait_idle_expect [ ] =
{
/* 0 */ { WAIT_TIMEOUT , WAIT_TIMEOUT , FALSE } ,
{ WAIT_TIMEOUT , 0 , FALSE } ,
{ WAIT_TIMEOUT , 0 , FALSE } ,
2009-12-16 17:32:15 +01:00
{ WAIT_TIMEOUT , WAIT_TIMEOUT , FALSE } ,
2009-12-15 13:10:53 +01:00
{ WAIT_TIMEOUT , WAIT_TIMEOUT , FALSE } ,
/* 5 */ { WAIT_TIMEOUT , 0 , FALSE } ,
{ WAIT_TIMEOUT , 0 , FALSE } ,
{ WAIT_TIMEOUT , WAIT_TIMEOUT , FALSE } ,
{ 0 , 0 , FALSE } ,
{ 0 , 0 , FALSE } ,
2009-12-16 18:18:07 +01:00
/* 10 */ { 0 , 0 , FALSE } ,
2009-12-15 13:10:53 +01:00
{ 0 , 0 , FALSE } ,
2009-12-16 17:22:34 +01:00
{ 0 , WAIT_TIMEOUT , FALSE } ,
2009-12-16 17:25:01 +01:00
{ 0 , 0 , FALSE } ,
2010-03-03 13:19:13 +01:00
{ 0 , 0 , FALSE } ,
/* 15 */ { 0 , 0 , FALSE } ,
{ WAIT_TIMEOUT , 0 , FALSE } ,
{ WAIT_TIMEOUT , 0 , FALSE } ,
{ WAIT_TIMEOUT , 0 , FALSE } ,
{ WAIT_TIMEOUT , 0 , FALSE } ,
/* 20 */ { WAIT_TIMEOUT , 0 , FALSE } ,
2009-12-15 13:10:53 +01:00
} ;
2009-12-16 17:25:01 +01:00
static DWORD CALLBACK do_wait_idle_child_thread ( void * arg )
{
MSG msg ;
PeekMessage ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) ;
Sleep ( 200 ) ;
MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 100 , QS_ALLINPUT ) ;
return 0 ;
}
2009-12-15 13:10:53 +01:00
static void do_wait_idle_child ( int arg )
{
WNDCLASS cls ;
MSG msg ;
HWND hwnd = 0 ;
2009-12-16 17:25:01 +01:00
HANDLE thread ;
DWORD id ;
2009-12-15 13:10:53 +01:00
HANDLE start_event = OpenEventA ( EVENT_ALL_ACCESS , FALSE , " test_WaitForInputIdle_start " ) ;
HANDLE end_event = OpenEventA ( EVENT_ALL_ACCESS , FALSE , " test_WaitForInputIdle_end " ) ;
memset ( & cls , 0 , sizeof ( cls ) ) ;
cls . lpfnWndProc = DefWindowProc ;
cls . hbrBackground = ( HBRUSH ) ( COLOR_WINDOW + 1 ) ;
cls . hCursor = LoadCursor ( 0 , IDC_ARROW ) ;
cls . lpszClassName = " TestClass " ;
RegisterClass ( & cls ) ;
PeekMessage ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) ; /* create the msg queue */
ok ( start_event ! = 0 , " failed to create start event, error %u \n " , GetLastError ( ) ) ;
ok ( end_event ! = 0 , " failed to create end event, error %u \n " , GetLastError ( ) ) ;
switch ( arg )
{
case 0 :
SetEvent ( start_event ) ;
break ;
case 1 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ;
break ;
case 2 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) ;
PostThreadMessage ( GetCurrentThreadId ( ) , WM_COMMAND , 0x1234 , 0xabcd ) ;
PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ;
break ;
case 3 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
SendMessage ( HWND_BROADCAST , WM_WININICHANGE , 0 , 0 ) ;
break ;
case 4 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
hwnd = CreateWindowExA ( 0 , " TestClass " , NULL , WS_POPUP | WS_VISIBLE , 0 , 0 , 10 , 10 , 0 , 0 , 0 , NULL ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE | PM_NOYIELD ) ) DispatchMessage ( & msg ) ;
break ;
case 5 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
hwnd = CreateWindowExA ( 0 , " TestClass " , NULL , WS_POPUP | WS_VISIBLE , 0 , 0 , 10 , 10 , 0 , 0 , 0 , NULL ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
break ;
case 6 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
hwnd = CreateWindowExA ( 0 , " TestClass " , NULL , WS_POPUP | WS_VISIBLE , 0 , 0 , 10 , 10 , 0 , 0 , 0 , NULL ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) )
{
GetMessage ( & msg , 0 , 0 , 0 ) ;
DispatchMessage ( & msg ) ;
}
break ;
case 7 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
hwnd = CreateWindowExA ( 0 , " TestClass " , NULL , WS_POPUP | WS_VISIBLE , 0 , 0 , 10 , 10 , 0 , 0 , 0 , NULL ) ;
SetTimer ( hwnd , 3 , 1 , NULL ) ;
2009-12-16 17:50:24 +01:00
Sleep ( 200 ) ;
2009-12-15 13:10:53 +01:00
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE | PM_NOYIELD ) ) DispatchMessage ( & msg ) ;
break ;
case 8 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) ;
MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 100 , QS_ALLINPUT ) ;
break ;
case 9 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
hwnd = CreateWindowExA ( 0 , " TestClass " , NULL , WS_POPUP | WS_VISIBLE , 0 , 0 , 10 , 10 , 0 , 0 , 0 , NULL ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
for ( ; ; ) GetMessage ( & msg , 0 , 0 , 0 ) ;
break ;
case 10 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
hwnd = CreateWindowExA ( 0 , " TestClass " , NULL , WS_POPUP | WS_VISIBLE , 0 , 0 , 10 , 10 , 0 , 0 , 0 , NULL ) ;
SetTimer ( hwnd , 3 , 1 , NULL ) ;
Sleep ( 200 ) ;
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) DispatchMessage ( & msg ) ;
break ;
case 11 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
return ; /* exiting the process makes WaitForInputIdle return success too */
case 12 :
PeekMessage ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) ;
Sleep ( 200 ) ;
MsgWaitForMultipleObjects ( 0 , NULL , FALSE , 100 , QS_ALLINPUT ) ;
SetEvent ( start_event ) ;
break ;
2009-12-16 17:25:01 +01:00
case 13 :
SetEvent ( start_event ) ;
PeekMessage ( & msg , 0 , 0 , 0 , PM_NOREMOVE ) ;
Sleep ( 200 ) ;
thread = CreateThread ( NULL , 0 , do_wait_idle_child_thread , NULL , 0 , & id ) ;
WaitForSingleObject ( thread , 10000 ) ;
CloseHandle ( thread ) ;
break ;
2010-03-03 13:19:13 +01:00
case 14 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , HWND_TOPMOST , 0 , 0 , PM_NOREMOVE ) ;
break ;
case 15 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , HWND_BROADCAST , 0 , 0 , PM_NOREMOVE ) ;
break ;
case 16 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , HWND_BOTTOM , 0 , 0 , PM_NOREMOVE ) ;
break ;
case 17 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , ( HWND ) 0xdeadbeef , 0 , 0 , PM_NOREMOVE ) ;
break ;
case 18 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , HWND_NOTOPMOST , 0 , 0 , PM_NOREMOVE ) ;
break ;
case 19 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , HWND_MESSAGE , 0 , 0 , PM_NOREMOVE ) ;
break ;
case 20 :
SetEvent ( start_event ) ;
Sleep ( 200 ) ;
PeekMessage ( & msg , GetDesktopWindow ( ) , 0 , 0 , PM_NOREMOVE ) ;
break ;
2009-12-15 13:10:53 +01:00
}
WaitForSingleObject ( end_event , 2000 ) ;
CloseHandle ( start_event ) ;
CloseHandle ( end_event ) ;
if ( hwnd ) DestroyWindow ( hwnd ) ;
}
static LRESULT CALLBACK wait_idle_proc ( HWND hwnd , UINT msg , WPARAM wp , LPARAM lp )
{
if ( msg = = WM_WININICHANGE ) Sleep ( 200 ) ; /* make sure the child waits */
return DefWindowProcA ( hwnd , msg , wp , lp ) ;
}
static DWORD CALLBACK wait_idle_thread ( void * arg )
{
WNDCLASS cls ;
MSG msg ;
HWND hwnd ;
memset ( & cls , 0 , sizeof ( cls ) ) ;
cls . lpfnWndProc = wait_idle_proc ;
cls . hbrBackground = ( HBRUSH ) ( COLOR_WINDOW + 1 ) ;
cls . hCursor = LoadCursor ( 0 , IDC_ARROW ) ;
cls . lpszClassName = " TestClass " ;
RegisterClass ( & cls ) ;
hwnd = CreateWindowExA ( 0 , " TestClass " , NULL , WS_POPUP , 0 , 0 , 10 , 10 , 0 , 0 , 0 , NULL ) ;
while ( GetMessage ( & msg , 0 , 0 , 0 ) ) DispatchMessage ( & msg ) ;
2010-05-01 22:19:08 +02:00
DestroyWindow ( hwnd ) ;
2009-12-15 13:10:53 +01:00
return 0 ;
}
static void test_WaitForInputIdle ( char * argv0 )
{
char path [ MAX_PATH ] ;
PROCESS_INFORMATION pi ;
STARTUPINFOA startup ;
BOOL ret ;
HANDLE start_event , end_event , thread ;
unsigned int i ;
DWORD id ;
const IMAGE_DOS_HEADER * dos = ( const IMAGE_DOS_HEADER * ) GetModuleHandleA ( 0 ) ;
const IMAGE_NT_HEADERS * nt = ( const IMAGE_NT_HEADERS * ) ( ( const char * ) dos + dos - > e_lfanew ) ;
BOOL console_app = ( nt - > OptionalHeader . Subsystem ! = IMAGE_SUBSYSTEM_WINDOWS_GUI ) ;
if ( console_app ) /* build the test with -mwindows for better coverage */
trace ( " not built as a GUI app, WaitForInputIdle may not be fully tested \n " ) ;
start_event = CreateEventA ( NULL , 0 , 0 , " test_WaitForInputIdle_start " ) ;
end_event = CreateEventA ( NULL , 0 , 0 , " test_WaitForInputIdle_end " ) ;
ok ( start_event ! = 0 , " failed to create start event, error %u \n " , GetLastError ( ) ) ;
ok ( end_event ! = 0 , " failed to create end event, error %u \n " , GetLastError ( ) ) ;
memset ( & startup , 0 , sizeof ( startup ) ) ;
startup . cb = sizeof ( startup ) ;
startup . dwFlags = STARTF_USESHOWWINDOW ;
startup . wShowWindow = SW_SHOWNORMAL ;
thread = CreateThread ( NULL , 0 , wait_idle_thread , NULL , 0 , & id ) ;
for ( i = 0 ; i < sizeof ( wait_idle_expect ) / sizeof ( wait_idle_expect [ 0 ] ) ; i + + )
{
2009-12-16 17:50:24 +01:00
ResetEvent ( start_event ) ;
ResetEvent ( end_event ) ;
2009-12-15 13:10:53 +01:00
sprintf ( path , " %s msg %u " , argv0 , i ) ;
ret = CreateProcessA ( NULL , path , NULL , NULL , TRUE , 0 , NULL , NULL , & startup , & pi ) ;
ok ( ret , " CreateProcess '%s' failed err %u. \n " , path , GetLastError ( ) ) ;
if ( ret )
{
ret = WaitForSingleObject ( start_event , 5000 ) ;
ok ( ret = = WAIT_OBJECT_0 , " %u: WaitForSingleObject failed \n " , i ) ;
if ( ret = = WAIT_OBJECT_0 )
{
ret = WaitForInputIdle ( pi . hProcess , 1000 ) ;
if ( ret = = WAIT_FAILED )
ok ( console_app | |
ret = = wait_idle_expect [ i ] . exp | |
broken ( ret = = wait_idle_expect [ i ] . broken ) ,
" %u: WaitForInputIdle error %08x expected %08x \n " ,
i , ret , wait_idle_expect [ i ] . exp ) ;
else if ( wait_idle_expect [ i ] . todo )
todo_wine
ok ( ret = = wait_idle_expect [ i ] . exp | | broken ( ret = = wait_idle_expect [ i ] . broken ) ,
" %u: WaitForInputIdle error %08x expected %08x \n " ,
i , ret , wait_idle_expect [ i ] . exp ) ;
else
ok ( ret = = wait_idle_expect [ i ] . exp | | broken ( ret = = wait_idle_expect [ i ] . broken ) ,
" %u: WaitForInputIdle error %08x expected %08x \n " ,
i , ret , wait_idle_expect [ i ] . exp ) ;
SetEvent ( end_event ) ;
WaitForSingleObject ( pi . hProcess , 1000 ) ; /* give it a chance to exit on its own */
}
TerminateProcess ( pi . hProcess , 0 ) ; /* just in case */
winetest_wait_child_process ( pi . hProcess ) ;
ret = WaitForInputIdle ( pi . hProcess , 100 ) ;
ok ( ret = = WAIT_FAILED , " %u: WaitForInputIdle after exit error %08x \n " , i , ret ) ;
CloseHandle ( pi . hProcess ) ;
CloseHandle ( pi . hThread ) ;
}
}
CloseHandle ( start_event ) ;
PostThreadMessage ( id , WM_QUIT , 0 , 0 ) ;
WaitForSingleObject ( thread , 10000 ) ;
CloseHandle ( thread ) ;
}
2003-10-02 06:32:56 +02:00
START_TEST ( msg )
{
2009-12-15 13:10:53 +01:00
char * * test_argv ;
2005-03-31 21:07:08 +02:00
BOOL ret ;
2009-09-09 13:12:46 +02:00
BOOL ( WINAPI * pIsWinEventHookInstalled ) ( DWORD ) = 0 ; /*GetProcAddress(user32, "IsWinEventHookInstalled");*/
2007-06-21 14:38:21 +02:00
2009-12-15 13:10:53 +01:00
int argc = winetest_get_mainargs ( & test_argv ) ;
if ( argc > = 3 )
{
unsigned int arg ;
/* Child process. */
sscanf ( test_argv [ 2 ] , " %d " , ( unsigned int * ) & arg ) ;
do_wait_idle_child ( arg ) ;
return ;
}
2007-06-21 14:38:21 +02:00
init_procs ( ) ;
2005-01-06 21:43:34 +01:00
2003-10-02 06:32:56 +02:00
if ( ! RegisterWindowClasses ( ) ) assert ( 0 ) ;
2005-01-06 21:43:34 +01:00
if ( pSetWinEventHook )
{
2009-02-05 09:53:39 +01:00
hEvent_hook = pSetWinEventHook ( EVENT_MIN , EVENT_MAX ,
GetModuleHandleA ( 0 ) , win_event_proc ,
0 , GetCurrentThreadId ( ) ,
WINEVENT_INCONTEXT ) ;
2009-02-17 14:57:57 +01:00
if ( pIsWinEventHookInstalled & & hEvent_hook )
2005-01-06 21:43:34 +01:00
{
2005-01-27 12:14:19 +01:00
UINT event ;
2005-01-06 21:43:34 +01:00
for ( event = EVENT_MIN ; event < = EVENT_MAX ; event + + )
ok ( pIsWinEventHookInstalled ( event ) , " IsWinEventHookInstalled(%u) failed \n " , event ) ;
}
}
2009-02-23 10:41:03 +01:00
if ( ! hEvent_hook ) win_skip ( " no win event hook support \n " ) ;
2005-01-06 21:43:34 +01:00
2005-01-27 12:14:19 +01:00
cbt_hook_thread_id = GetCurrentThreadId ( ) ;
2004-03-26 01:18:20 +01:00
hCBT_hook = SetWindowsHookExA ( WH_CBT , cbt_hook_proc , 0 , GetCurrentThreadId ( ) ) ;
2009-02-23 10:41:03 +01:00
if ( ! hCBT_hook ) win_skip ( " cannot set global hook, will skip hook tests \n " ) ;
2004-03-26 01:18:20 +01:00
2005-02-03 17:40:20 +01:00
test_winevents ( ) ;
2005-11-14 12:24:06 +01:00
/* Fix message sequences before removing 4 lines below */
# if 1
2006-05-23 11:58:00 +02:00
if ( pUnhookWinEvent & & hEvent_hook )
{
ret = pUnhookWinEvent ( hEvent_hook ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " UnhookWinEvent error %d \n " , GetLastError ( ) ) ;
2006-05-23 11:58:00 +02:00
pUnhookWinEvent = 0 ;
}
2005-02-03 17:40:20 +01:00
hEvent_hook = 0 ;
2005-11-14 12:24:06 +01:00
# endif
2005-02-03 17:40:20 +01:00
2009-06-11 14:49:31 +02:00
test_PostMessage ( ) ;
2006-12-22 11:32:04 +01:00
test_ShowWindow ( ) ;
2005-12-22 13:58:11 +01:00
test_PeekMessage ( ) ;
2007-10-04 21:51:37 +02:00
test_PeekMessage2 ( ) ;
2009-12-15 13:10:53 +01:00
test_WaitForInputIdle ( test_argv [ 0 ] ) ;
2005-02-08 15:27:39 +01:00
test_scrollwindowex ( ) ;
2003-10-02 06:32:56 +02:00
test_messages ( ) ;
2008-07-15 01:50:56 +02:00
test_setwindowpos ( ) ;
2007-01-07 12:40:46 +01:00
test_showwindow ( ) ;
2006-05-16 12:33:19 +02:00
invisible_parent_tests ( ) ;
2004-06-23 22:51:21 +02:00
test_mdi_messages ( ) ;
2004-08-10 01:38:40 +02:00
test_button_messages ( ) ;
2006-11-21 12:45:07 +01:00
test_static_messages ( ) ;
2008-03-27 07:35:59 +01:00
test_listbox_messages ( ) ;
test_combobox_messages ( ) ;
2008-04-30 13:50:19 +02:00
test_wmime_keydown_message ( ) ;
2004-08-26 02:49:06 +02:00
test_paint_messages ( ) ;
2004-10-06 00:35:00 +02:00
test_interthread_messages ( ) ;
2004-10-04 21:10:37 +02:00
test_message_conversion ( ) ;
2004-10-06 01:45:35 +02:00
test_accelerators ( ) ;
2004-11-29 19:21:14 +01:00
test_timers ( ) ;
2007-08-30 11:05:50 +02:00
test_timers_no_wnd ( ) ;
2009-01-23 13:14:05 +01:00
if ( hCBT_hook ) test_set_hook ( ) ;
2005-02-18 21:01:41 +01:00
test_DestroyWindow ( ) ;
2005-02-22 15:58:52 +01:00
test_DispatchMessage ( ) ;
2005-09-13 16:46:46 +02:00
test_SendMessageTimeout ( ) ;
2005-11-16 12:22:54 +01:00
test_edit_messages ( ) ;
2006-01-17 13:14:31 +01:00
test_quit_message ( ) ;
2008-06-25 14:40:41 +02:00
test_SetActiveWindow ( ) ;
2007-08-15 14:23:45 +02:00
if ( ! pTrackMouseEvent )
2009-02-23 10:41:03 +01:00
win_skip ( " TrackMouseEvent is not available \n " ) ;
2007-08-15 14:23:45 +02:00
else
test_TrackMouseEvent ( ) ;
2006-10-30 17:43:38 +01:00
test_SetWindowRgn ( ) ;
2006-11-02 12:18:32 +01:00
test_sys_menu ( ) ;
2007-02-20 10:06:21 +01:00
test_dialog_messages ( ) ;
2007-02-24 19:57:22 +01:00
test_nullCallback ( ) ;
2007-08-08 18:25:57 +02:00
test_dbcs_wm_char ( ) ;
2008-06-18 05:34:01 +02:00
test_menu_messages ( ) ;
2008-08-26 16:55:05 +02:00
test_paintingloop ( ) ;
2009-02-18 07:49:15 +01:00
test_defwinproc ( ) ;
2009-09-20 00:29:44 +02:00
test_clipboard_viewers ( ) ;
2008-06-24 10:48:08 +02:00
/* keep it the last test, under Windows it tends to break the tests
* which rely on active / foreground windows being correct .
*/
test_SetForegroundWindow ( ) ;
2004-03-26 01:18:20 +01:00
UnhookWindowsHookEx ( hCBT_hook ) ;
2009-02-17 14:57:57 +01:00
if ( pUnhookWinEvent & & hEvent_hook )
2005-01-11 11:38:31 +01:00
{
2005-03-31 21:07:08 +02:00
ret = pUnhookWinEvent ( hEvent_hook ) ;
2006-10-07 21:45:11 +02:00
ok ( ret , " UnhookWinEvent error %d \n " , GetLastError ( ) ) ;
2005-01-11 11:38:31 +01:00
SetLastError ( 0xdeadbeef ) ;
ok ( ! pUnhookWinEvent ( hEvent_hook ) , " UnhookWinEvent succeeded \n " ) ;
ok ( GetLastError ( ) = = ERROR_INVALID_HANDLE | | /* Win2k */
GetLastError ( ) = = 0xdeadbeef , /* Win9x */
2006-10-07 21:45:11 +02:00
" unexpected error %d \n " , GetLastError ( ) ) ;
2005-01-11 11:38:31 +01:00
}
2003-10-02 06:32:56 +02:00
}