The message structure consistent with twmmouse is as follows:
Detail {left-click} twmlbuttondown {left-click} twmlbuttonup {left-click to raise} twmmbuttondblclk {middle-click} twmmbuttondown {middle-click to press} twmmbuttonup {middle-click to move} else {right-click} twmrbuttondown {right-click and press} twmrbuttonup {right-click to raise}
Code file:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) memo1: tmemo; checkbox1: tcheckbox; button1: tbutton; Procedure formcreate (Sender: tobject); Procedure button1click (Sender: tobject); protected procedure success (VAR message: Success); message success; Procedure wmlbuttondown (VAR message: twmlbuttondown); message wm_lbuttondown; Procedure wmlbuttonup (VAR message: twmlbuttonup); Message failed; procedure failed (VAR message: Success); Message failed; Procedure wmmbuttondown (VAR message: twmmbuttondown ); message wm_mbuttondown; Procedure wmmbuttonup (VAR message: twmmbuttonup); Message failed; Procedure wmmousemove (VAR message: twmmousemove); message wm_mousemove; procedure failed (VAR message: Success); Message failed; procedure wmrbuttondown (VAR message: twmrbuttondown); message wm_rbuttondown; Procedure wmrbuttonup (VAR message: twmrbuttonup); message success; end; var form1: tform1; implementation {$ R *. DFM} procedure merge (Sender: tobject); begin memo1.clear; end; procedure merge (Sender: tobject); begin memo1.align: = alleft; cursor: = ssvertical; memo1.clear; position: = poscreencenter; checkbox1.caption: = 'move the cursor accepted message'; button1.caption: = 'clear list'; end; Procedure tform1.wmlbuttondblclk (VAR message: twmlbuttondblclk); var X, Y: integer; s: string; begin X: = message. xpos; Y: = message. ypos; s: = format ('double click % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end; Procedure tform1.wmlbuttondown (VAR message: twmlbuttondown); var X, Y: integer; s: string; begin X: = message. xpos; Y: = message. ypos; s: = format ('Press the left mouse button: % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end; Procedure tform1.wmlbuttonup (VAR message: twmlbuttonup); var X, Y: integer; s: string; begin X: = message. xpos; Y: = message. ypos; s: = format ('left mouse lifted: % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end; Procedure tform1.wmmbuttondblclk (VAR message: twmmbuttondblclk); var X, Y: integer; s: string; begin X: = message. xpos; Y: = message. ypos; s: = format ('double click % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end; Procedure tform1.wmmbuttondown (VAR message: twmmbuttondown); var X, Y: integer; s: string; begin X: = message. xpos; Y: = message. ypos; s: = format ('Press % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end; Procedure tform1.wmmbuttonup (VAR message: twmmbuttonup); var X, Y: integer; s: string; begin X: = message. xpos; Y: = message. ypos; s: = format ('hover the mouse up: % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end; Procedure tform1.wmmousemove (VAR message: twmmousemove); var X, Y: integer; s: string; begin if not checkbox1.checked then exit; X: = message. xpos; Y: = message. ypos; s: = format ('move the mouse: % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end; Procedure tform1.wmrbuttondblclk (VAR message: twmrbuttondblclk); var X, Y: integer; s: string; begin X: = message. xpos; Y: = message. ypos; s: = format ('right-click: % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end; Procedure tform1.wmrbuttondown (VAR message: twmrbuttondown); var X, Y: integer; s: string; begin X: = message. xpos; Y: = message. ypos; s: = format ('right-click and press: % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end; Procedure tform1.wmrbuttonup (VAR message: twmrbuttonup); var X, Y: integer; s: string; begin X: = message. xpos; Y: = message. ypos; s: = format ('right-click to raise: % d, % d', [x, y]); memo1.lines. add (s); message. result: = 0; end.
Form file:
object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 206 ClientWidth = 321 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Memo1: TMemo Left = 8 Top = 8 Width = 185 Height = 89 Lines.Strings = ( 'Memo1') TabOrder = 0 end object CheckBox1: TCheckBox Left = 199 Top = 8 Width = 122 Height = 17 Caption = 'CheckBox1' TabOrder = 1 end object Button1: TButton Left = 199 Top = 173 Width = 75 Height = 25 Caption = 'Button1' TabOrder = 2 OnClick = Button1Click endend