procedure TMainForm.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
if (Msg.hwnd = Handle) and (Msg.message=WM_LButtonDown) and (DefWindowProc(Handle,WM_NCHitTest,0,GetMessagePos)=HTClient) then //判断是否按下左键及是否在位置在客户区
begin
SendMessage(Handle,WM_NCLButtonDown,HTCaption,GetMessagePos); //发送鼠标在标题栏内按下的消息
Handled:=true;
end;
end;