I have two windows that I want to stay next to each other when they are moved.
I have an idea how to do it but I have encountered a few problems. If anyone knows what I'm doing wrong or has a better idea how to do it please feel free to let me know.

I created an event function for whenever the main window's position changes.
Whevever it changes I want the second window to follow the main one to it's new coordinates by used SetWindowPos().
Code:
void CFXBOXDlg::OnWindowPosChanged(WINDOWPOS* lpwndpos)
{
	CDialog::OnWindowPosChanged(lpwndpos);

	// TODO: Add your message handler code here

	m_dialogX = 0; // I want to insert the coordinates into these variables
	m_dialogY = 0;
	
	CWnd * apptr = FindWindow(0, "Guitar FX BOX 2.6"); //gets handle to main window

	apptr->SetWindowPos(&wndTopMost, m_dialogX, m_dialogY, 0, 0, SWP_NOSIZE); //sets the second window to its new position
}
I want to send the SetWindowPos() the new coordinates of the window but I havent had any luck figuring of how to get them.

Also, even if I were to get the coordinates, everytime the window moves it puts focus on the second window when SetWindowPos() is triggered. This means I can move the main window by little steps at a time and it's very annoying.