ドラッグするとメインウィンドウを移動するこのコードがありますMyThingThatDragsIt
procedure TMainForm.ApplicationMessage(var Msg: TMsg; var Handled: Boolean);
var
ScreenPt : TPoint;
DragControl : TControl;
begin
inherited;
if Msg.message = WM_LBUTTONDOWN then
begin
ScreenPt := ScreenToClient(Msg.pt);
DragControl := FindDragTarget(Msg.pt , false);
if Assigned(DragControl) and
((DragControl = MyThingThatDragsIt)
) then
begin
ReleaseCapture;
self.Perform(WM_SYSCOMMAND, SC_MOVE or $0002, 0 );
end;
end
end;
それは問題なく動作しますが、手を離すとプログラムがフォーカスを失い、他のボタンをクリックするためにフォームを 1 回クリックする必要があります。
ここで何が間違っているのですか?この質問の手順に従いました