📄 sendmessagecallbacku.pas
字号:
unit SendMessageCallbackU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
{the callback function}
procedure MessageCallback(Window: HWND; Msg: UINT; Data: DWORD;
LResult: LRESULT); stdcall;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
{send the message, specifying a callback function}
SendMessageCallback(Form1.Handle, WM_SYSCOMMAND, SC_MAXIMIZE, 0,
@MessageCallback, 12345);
end;
procedure MessageCallback(Window:HWND; Msg:UINT; Data:DWORD; LResult:LRESULT);
begin
{when the message is received, this function is called}
ShowMessage('The message callback function was called: '+IntToStr(Data));
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -