.


:




:

































 

 

 

 


Windows ( , , )




 

Windows , . : PerForm() ( API Windows), API Win32 SendMessage() PostMessage().

PerForm(), TControl:

function TControl.Perform(Msg: Cardinal; WParam, LParam: Longint): Longint;

, :

RetVal:= ControlName.PerForm(MessageID, wParam, lParam);

PerForm() , . , API Windows.

API SendMessage() PostMessage(), Windows :

function SendMessage(hWnd: HWND; Msg: UINT; wParam: WPARAM;

lParam: LPARAM): LRESULT; stdcall;

function PostMessage(hWnd: HWND; Msg: UINT;

wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;

hWnd ; Msg ; wParam lParam .

SendMessage() PerForm() , PostMessage() , .

SendMessage() , . PostMessage() , , .

 

, , . , , Windows WM_USER $7FFF.

:

const

TestMsg = WM_USER + 100; //

 

type

TForm1 = class(TForm)

private

// :

procedure MyMessage(var Msg: TMessage); message TestMsg;

end;

...

procedure TForm1.MyMessage(var Msg: TMessage);

begin

ShowMessage(' TestMsg');

Msg.Result:= 1; //

end;

:

if Form1.PerForm(TestMsg, 0, 0) = 1 then

ShowMessage(' ');

if SendMessage(Form1.Handle, TestMsg, 0, 0) = 1 then

ShowMessage(' ');

if PostMessage(Form1.Handle, TestMsg, 0, 0) then

ShowMessage(' ');

 

Delphi

, . Delphi, , . , . .

-.

"On", .

 

Delphi Windows, . VCL Windows WM_XXX:

 

 





:


: 2016-11-19; !; : 1081 |


:

:

, , . , .
==> ...

1623 - | 1458 -


© 2015-2024 lektsii.org - -

: 0.011 .