Not exactly what you're looking for, but for others interested in a similar technique, here's code for a TLabel-descended component that can serve as a caption bar:
unit Draglbl;
interface
uses
WinTypes, WinProcs, Classes, Graphics, Controls, Forms, StdCtrls;
type
TDragWindowTitle = class(TCustomLabel)
private
{ Private declarations }
_lastx,
_lasty : integer ;
protected
{ Protected declarations }
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override ;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override ;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
property Alignment;
property Caption;
property Color;
property DragCursor;
property DragMode;
property Enabled;
property FocusControl;
property Font;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Visible;
property WordWrap;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;
procedure Register;
implementation
constructor TDragWindowTitle.Create(AOwner: TComponent);
begin
inherited Create(AOwner) ;
color := clActiveCaption ;
font := TForm(AOwner).Font ;
font.color := clCaptionText ;
Align := alTop ;
AutoSize := false ;
ShowAccelChar := false ;
Transparent := false ;
end ;
procedure TDragWindowTitle.MouseMove(Shift: TShiftState; X, Y: Integer);
begin
if ssLeft in Shift then begin
TForm(owner).left := TForm(owner).left+(x-_lastx) ;
TForm(owner).top := TForm(owner).top+(y-_lasty) ;
end ;
inherited MouseMove(shift,x,y) ;
end ;
procedure TDragWindowTitle.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button=mbLeft then begin
_lastx := x;
_lasty := y ;
end ;
end ;
procedure Register;
begin
RegisterComponents('MYCOMPONENTS', [TDragWindowTitle]);
end;
end.