How can I tell if the grid or one of its children has the focus?

You can call

CWnd* pFocus = GetFocus();
BOOL bFocus = (pFocus == this || IsChild(pFocus));