, VCL. Delphi Windows Delphi.
Windows , Windows . , , Windows , , . , Windows :
type
TMsg = packed record
hwnd: HWND; // -
message: UINT; //
wParam: WPARAM; // 32
lParam: LPARAM; // 32
time: DWORD; //
pt: TPoint; //
end;
Windows , message TMsg. Delphi , Messages. WM (Windows Message). .
WM_ACTIVATE | $0006 | . , wParam (LOWORD(wParam)). BOOL, True, . lParam , , , , |
WM KEYDOWN | $0100 | |
WM KEYUP | $0101 | |
WM PAINT | $000F | |
WM CLOSE | $0010 | |
WM_QUIT | $0012 |
wParam lParam .
Windows
Windows :
1. . Windows . Windows .
2. . , .
3. . , . .
Forms, . , Delphi TMsg TMessage.
|
|
type
TMessage = packed record
Msg: Cardinal;
case Integer of
0: (WParam: Longint;
LParam: Longint;
Result: Longint);
1: (WParamLo: Word;
WParamHi: Word;
LParamLo: Word;
LParamHi: Word;
ResultLo: Word;
ResultHi: Word);
end;
, TMsg. , TMessage Result, .
Delphi
, .
Delphi .
1. .
2. WndProc.
3. Dispatch.
4. OnMessage Application.
1. Windows, . :
.
var- TMessage .
message , .
, WM_PAINT:
procedure WMPaint(var Msg: TWMPaint); message WM_PAINT;
2. TControl WndProc:
procedure WndProc(var Message: TMessage); virtual;
, .
3. TObject Dispatch:
procedure Dispatch(var Message); virtual;
-, .
4. OnMessage Application.
// Forms:
type
TMessageEvent = procedure (var Msg: TMsg; var Handled: Boolean) of object;
...
TApplication = class(TComponent)
...
property OnMessage: TMessageEvent read FOnMessage write FOnMessage;
...
, , , .
TMessage Delphi Windows. wParam lParam.
, ( T, ). WM_ACTIVATE.
// Windows:
const
{ WM_ACTIVATE state values }
WA_INACTIVE = 0;
WA_ACTIVE = 1;
WA_CLICKACTIVE = 2;
// Messages:
type
TWMActivate = packed record
Msg: Cardinal;
Active: Word; // WA_INACTIVE, WA_ACTIVE, WA_CLICKACTIVE
Minimized: WordBool;
ActiveWindow: HWND;
Result: Longint;
end;