Q:

How to send WM_ENTERSIZEMOVE?

I have the following code called on WM_MOVE
procedure TForm15.WMMove(var Message: TMessage);
begin
if( (((TWMMove(Message).XPos + Self.Width >= Form14.Left) and (TWMMove(Message).XPos <= Form14.Left)) or
  ((TWMMove(Message).XPos <= Form14.Left + Form14.Width) and (TWMMove(Message).XPos >= Form14.Left))) and
(((TWMMove(Message).YPos + Self.Height >= Form14.Top) and (TWMMove(Message).YPos <= Form14.Top)) or
  ((TWMMove(Message).YPos <= Form14.Top + Form14.Height) and (TWMMove(Message).YPos >= Form14.Top))))
 then begin
   Self.DragKind := dkDock;
 end else Self.DragKind := dkDrag;
end;

It's probably the ugliest if statement you've seen in your life,but that's not the question. :)
It's supposed to change DragKind if the current form(Self) is somewhere inside the mainForm(Form14).
However,When It sets DragKind to dkDock ,it doesn't make the currentForm(Self) dockable unless the user stops moving the form and start moving it again,so I'm trying to do the following:
If the result from the statement above is non zero and dkDock is set then Send the following messages to the form:
WM_EXITSIZEMOVE //stop moving the form
WM_ENTERSIZEMOVE //start movement again
However,I don't know how to do it:
SendMessage(Self.Handle,WM_EXITSIZEMOVE,?,?);

I tried using random parameters(1,1) ,but no effect.Maybe that's not the right way?

A:

It looks like those two messages are notifications - directly sending them probably doesn't do anything.  As Raymond Chen once said (horribly paraphrased), directly sending these messages and expecting action is like trying to refill your gas tank by moving the needle in the gauge.
WM_SIZING and WM_MOVING are messages that you can use to monitor a user changing a window's size and position, and block further changes.
From MSDN:

lParam
Pointer to a RECT structure
with the current position of the
window, in screen coordinates. To
change the position of the drag
rectangle, an application must change
the members of this structure.

So you can change the members to force the window to remain in a single position.

