Intercept form WM_SysCommand message through the following examples, we can get to a lot of interesting data.
First, the program interface
Second, the program code
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
private
{ Private declarations }
procedure MyWMSysCommand(var AMessage: TWMSysCommand); message WM_SysCommand;
public
{ Public declarations }
end; var Form1: TForm1; implementation {$R *.dfm} procedure Tform1.MyWMSysCommand(var AMessage: TWMSysCommand); var str: string; begin case AMessage.CmdType of //可能通过查找TWMSysCommand结构体查找wParam以下参数 SC_SIZE: str := 'SIZE '; SC_MOVE: str := 'MOVE '; SC_MINIMIZE: str := 'MINIMIZE '; SC_MAXIMIZE: str := 'MAXIMIZE '; SC_NEXTWINDOW: str := 'NEXTWINDOW '; SC_PREVWINDOW: str := 'PREVWINDOW '; SC_CLOSE: str := 'CLOSE '; SC_VSCROLL: str := 'VSCROLL '; SC_HSCROLL: str := 'HSCROLL '; SC_MOUSEMENU: str := 'MOUSEMENU '; SC_KEYMENU: str := 'KEYMENU '; SC_ARRANGE: str := 'ARRANGE '; SC_RESTORE: str := 'RESTORE '; SC_TASKLIST: str := 'TASKLIST '; SC_SCREENSAVE: str := 'SCREENSAVE '; SC_HOTKEY: str := 'HOTKEY '; SC_DEFAULT: str := 'DEFAULT '; SC_MONITORPOWER: str := 'MONITORPOWER '; SC_CONTEXTHELP: str := 'CONTEXTHELP '; SC_SEPARATOR: STR: = 'SEPARATOR' ; 61441 : STR: = 'Drag left border' ; 61442 : STR: = 'drag the right box' ; 61443 : STR: = 'drag the frame' ; 61444 : STR: = 'drag the top left' ; 61445 : STR: = 'drag the top right' ; 61446 : STR: = 'drag the frame' ; 61447 : STR: = 'drag the bottom left' ; 61448 : STR: = ' drag bottom right ' ; 61458 : STR: =' dragging the title bar ' ; 61558 : STR: =' horizontal scroll bar to scroll ' ; 61574 : STR: =' Double-horizontal scrollbar ' ; 61575 : STR: =' vertical scroll scroll bars' ; 61 559 : STR: = 'Double-vertical scroll bar' ; 61587 : STR: = 'click minimized icon' ;61490 : str: = 'Double-click the title bar at the non-maximized' ; 61730: Str: = 'double-clicking the title bar when maximized' ; End ; ListBox1.Items.Add (STR); ListBox1.Items.Add (the Format ( 'X-: dY%:% 2D' , [AMessage.XPos, aMessage. YPos])); ListBox1.Perform (WM_VSCROLL , SB_BOTTOM, 0); // VScroll in the end portion is moved to ensure that the newly added text is always visible. Find TWMScroll structure can find the second parameter SB_XXXX inherited; // comment this line, the window will not be closed End ; End.