📄 msg.c
字号:
/* * Unit tests for window message handling * * Copyright 1999 Ove Kaaven * Copyright 2003 Dimitrie O. Paun * * 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 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include <assert.h>#include <stdlib.h>#include <stdarg.h>#include <stdio.h>#include "windef.h"#include "winbase.h"#include "wingdi.h"#include "winuser.h"#include "wine/test.h"/*FIXME: add tests for theseWindow 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*/typedef enum { sent=0x1, posted=0x2, parent=0x4, wparam=0x8, lparam=0x10, defwinproc=0x20} msg_flags_t;struct message { UINT message; /* the WM_* code */ msg_flags_t flags; /* message props */ WPARAM wParam; /* expacted value of wParam */ LPARAM lParam; /* expacted value of lParam */};/* CreateWindow (for overlapped window, not initially visible) (16/32) */static struct message WmCreateOverlappedSeq[] = { { WM_GETMINMAXINFO, sent }, { WM_NCCREATE, sent }, { WM_NCCALCSIZE, sent|wparam, 0 }, { WM_CREATE, sent }, { 0 }};/* ShowWindow (for overlapped window) (16/32) */static struct message WmShowOverlappedSeq[] = { { WM_SHOWWINDOW, sent|wparam, 1 }, { WM_WINDOWPOSCHANGING, sent|wparam, /*FIXME: SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW*/ 0 }, /* FIXME: WM_QUERYNEWPALETTE, if in 256-color mode */ { WM_WINDOWPOSCHANGING, sent|wparam, /*FIXME: SWP_NOMOVE|SWP_NOSIZE*/ 0 }, { WM_ACTIVATEAPP, sent|wparam, 1 }, { WM_NCACTIVATE, sent|wparam, 1 }, { WM_GETTEXT, sent|defwinproc }, { WM_ACTIVATE, sent|wparam, 1 }, { WM_SETFOCUS, sent|wparam|defwinproc, 0 }, { WM_NCPAINT, sent|wparam, 1 }, { WM_GETTEXT, sent|defwinproc }, { WM_ERASEBKGND, sent }, { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_SHOWWINDOW }, { WM_SIZE, sent }, { WM_MOVE, sent }, { 0 }};/* DestroyWindow (for overlapped window) (32) */static struct message WmDestroyOverlappedSeq[] = { { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, { WM_NCACTIVATE, sent|wparam, 0 }, { WM_ACTIVATE, sent|wparam, 0 }, { WM_ACTIVATEAPP, sent|wparam, 0 }, { WM_KILLFOCUS, sent|wparam, 0 }, { WM_DESTROY, sent }, { WM_NCDESTROY, sent }, { 0 }};/* CreateWindow (for child window, not initially visible) */static struct message WmCreateChildSeq[] = { { WM_NCCREATE, sent }, /* child is inserted into parent's child list after WM_NCCREATE returns */ { WM_NCCALCSIZE, sent|wparam, 0 }, { WM_CREATE, sent }, { WM_SIZE, sent }, { WM_MOVE, sent }, { WM_PARENTNOTIFY, sent|parent|wparam, 1 }, { 0 }};/* ShowWindow (for child window) */static struct message WmShowChildSeq[] = { { WM_SHOWWINDOW, sent|wparam, 1 }, { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, { WM_ERASEBKGND, sent|parent }, { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, { 0 }};/* DestroyWindow (for child window) */static struct message WmDestroyChildSeq[] = { { WM_PARENTNOTIFY, sent|parent|wparam, 2 }, { WM_SHOWWINDOW, sent|wparam, 0 }, { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, { WM_ERASEBKGND, sent|parent }, { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, { WM_DESTROY, sent }, { WM_NCDESTROY, sent }, { 0 }};/* Moving the mouse in nonclient area */static struct message WmMouseMoveInNonClientAreaSeq[] = { /* FIXME: add */ { WM_NCHITTEST, sent }, { WM_SETCURSOR, sent }, { WM_NCMOUSEMOVE, posted }, { 0 }};/* Moving the mouse in client area */static struct message WmMouseMoveInClientAreaSeq[] = { /* FIXME: add */ { WM_NCHITTEST, sent }, { WM_SETCURSOR, sent }, { WM_MOUSEMOVE, posted }, { 0 }};/* Moving by dragging the title bar (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */static struct message WmDragTitleBarSeq[] = { /* FIXME: add */ { WM_NCLBUTTONDOWN, sent|wparam, HTCAPTION }, { WM_SYSCOMMAND, sent|defwinproc|wparam, SC_MOVE+2 }, { WM_GETMINMAXINFO, sent|defwinproc }, { WM_ENTERSIZEMOVE, sent|defwinproc }, { WM_WINDOWPOSCHANGING, sent|defwinproc }, { WM_WINDOWPOSCHANGED, sent|defwinproc }, { WM_MOVE, sent|defwinproc }, { WM_EXITSIZEMOVE, sent|defwinproc }, { 0 }};/* Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */static struct message WmDragThinkBordersBarSeq[] = { /* FIXME: add */ { 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 */ { WM_WINDOWPOSCHANGING, sent|defwinproc }, { WM_GETMINMAXINFO, sent|defwinproc }, { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 }, { WM_NCPAINT, sent|defwinproc|wparam, 1 }, { WM_GETTEXT, sent|defwinproc }, { WM_ERASEBKGND, sent|defwinproc }, { WM_WINDOWPOSCHANGED, sent|defwinproc }, { WM_MOVE, sent|defwinproc }, { WM_SIZE, sent|defwinproc }, { WM_EXITSIZEMOVE, sent|defwinproc }, { 0 }};/* Resizing child window with MoveWindow (32) */static struct message WmResizingChildWithMoveWindowSeq[] = { { WM_WINDOWPOSCHANGING, sent }, { WM_NCCALCSIZE, sent|wparam, 1 }, { WM_ERASEBKGND, sent }, { WM_WINDOWPOSCHANGED, sent }, { WM_MOVE, sent|defwinproc }, { WM_SIZE, sent|defwinproc }, { 0 }};/* Clicking on inactive button */static struct message WmClickInactiveButtonSeq[] = { /* FIXME: add */ { 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. */static struct message WmReparentButtonSeq[] = { /* FIXME: add */ { WM_SHOWWINDOW, sent|wparam, 0 }, { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER }, { WM_ERASEBKGND, sent|parent }, { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER }, { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOZORDER }, { WM_CHILDACTIVATE, sent }, { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOREDRAW|SWP_NOZORDER }, { WM_MOVE, sent|defwinproc }, { WM_SHOWWINDOW, sent|wparam, 1 }, { 0 }};/* Creation of a modal dialog (32) */static struct message WmCreateModalDialogSeq[] = { /* FIXME: add */ { WM_CANCELMODE, sent|parent }, { WM_KILLFOCUS, sent|parent }, { WM_ENABLE, sent|parent|wparam, 0 }, /* (window proc creation messages not tracked yet, because...) */ { WM_SETFONT, sent }, { WM_INITDIALOG, sent }, /* (...the window proc message hook was installed here, IsVisible still FALSE) */ { WM_NCACTIVATE, sent|parent|wparam, 0 }, { WM_GETTEXT, sent|defwinproc }, { WM_ACTIVATE, sent|parent|wparam, 0 }, { WM_WINDOWPOSCHANGING, sent }, { WM_WINDOWPOSCHANGING, sent|parent }, { WM_NCACTIVATE, sent|wparam, 1 }, { WM_ACTIVATE, sent|wparam, 1 }, /* (setting focus) */ { WM_SHOWWINDOW, sent|wparam, 1 }, { WM_WINDOWPOSCHANGING, sent }, { WM_NCPAINT, sent }, { WM_GETTEXT, sent|defwinproc }, { WM_ERASEBKGND, sent }, { WM_CTLCOLORDLG, sent|defwinproc }, { WM_WINDOWPOSCHANGED, sent }, { WM_PAINT, sent }, /* FIXME: (bunch of WM_CTLCOLOR* for each control) */ { WM_PAINT, sent|parent }, { WM_ENTERIDLE, sent|parent|wparam, 0},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -