const
UM_TEST = WM_USER + $001;
var
OldWProc : TFNWndProc;
function NewWndProc(Handle: HWND; Msg: Integer; wParam, lParam: Longint):
Longint; stdcall;
begin
if Msg = UM_TEST then
begin
Form1.Caption := 'ok';
end;
Result := CallWindowProc(OldWProc, Handle, Msg, wParam, lParam);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldWProc := TFNWndProc(SetWindowLong(Application.Handle, GWL_WNDPROC,
Longint(@NewWndProc)));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SendAppMessage(UM_TEST, 0, 0);
end;