The GetFocus function retrieves the handle to the window that has the keyboard focus, if the window is attached to the calling thread's message queue. SyntaxHWND GetFocus(VOID);
Return ValueThe return value is the handle to the window with the keyboard focus. If the calling thread's message queue does not have an associated window with the keyboard focus, the return value is NULL. 
///////////////
if(::GetFocus() == GetDlgItem(IDC_EDIT1)->m_hWnd)
{// focus is on IDC_EDIT1
}