Managed to to solved this.
Using the OnMoving function and ON_WM_MOVING message, just change the values of the function parameter of the LPRECT to the current window size.
void MyClass::OnMoving(UINT nSide, LPRECT lpRect)
{
CDialog::OnMoving(nSide, lpRect);
CRect CurRect;
GetWindowRect(&CurRect);
lpRect->left = CurRect.left;
lpRect->top = CurRect.top;
lpRect->right = CurRect.right;
lpRect->bottom = CurRect.bottom;
}