1

I want to run a block of code after my form has been moved on the screen by the traditional "left-mouse down on caption bar and drag to new spot". OnMouseUp only works on the form itself, not for mouse click on the title bar.

This is C++ and Win32 app.

thanks, russ

UPDATE 1: Showing code i implemented based on Remy's answer. I implemented his code from that other post and then added another item to the switch(uMsg) to catch the WM_MOVE message. This didn't work.

case WM_MOVE:
{
ShowMessage("Moved");
}

UPDATE 2: I changed the above from WM_MOVE to WM_EXITSIZEMOVE based on Remy's comment and it works great now. Fires 1 time when i get through moving the form.

case WM_EXITSIZEMOVE:
{
ShowMessage("Moved");
}

Just what i wanted.

relayman357
  • 793
  • 1
  • 6
  • 30

1 Answers1

2

FireMonkey does not natively support what you are asking for. You will have to manually subclass the Form's HWND (see this answer) to intercept messages like WM_MOVING, WM_MOVE, WM_ENTERSIZEMOVE, WM_EXITSIZEMOVE, etc.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • I used the [reference you gave](https://stackoverflow.com/questions/53576639/detect-screen-lock-fmx-in-win32/53578818#53578818) and just added code for `WM_MOVE`. It only fires 1 time when i start the application. It never fires again when i move the form. See my "UPDATE 1" code above. – relayman357 Dec 09 '18 at 00:27
  • 1
    @relayman357 what about WM_MOVING, WM_ENTERSIZEMOVE, and WM_EXITSIZEMOVE? – Remy Lebeau Dec 09 '18 at 00:43
  • Awesome, `WM_EXITSIZEMOVE` is the one to use. It works and fires after i let go of the form (left mouse up) after dragging it by the caption bar. This is exactly what i wanted. Thank you sir! – relayman357 Dec 09 '18 at 00:59