Capture mouse as it exits a control

Use CM_MOUSEENTER and CM_MOUSELEAVE messages:

   TYourObject = class(TAnyControl)
  ...
  private
    procedure CMMouseEnter(var AMsg: TMessage); message CM_MOUSEENTER;
    procedure CMMouseLeave(var AMsg: TMessage); message CM_MOUSELEAVE;
  ...
  end;

implementation

procedure TYourObject.CMMouseEnter(var AMsg: TMessage);
begin
  MessageBox(Parent.Handle,'Mouse enter','Message',MB_OK);
end;

procedure TYourObject.CMMouseLeave(var AMsg: TMessage);
begin
  MessageBox(Parent.Handle,'Mouse leave','Message',MB_OK);
end;