Assuming you are using ATL. Following snippet assumes pt contains the screen coordinates of the mouse cursor and pAuto contains an IUIAutomation interace pointer.
CComPtr<IUIAutomationElement> pElement;
CComPtr<IAccessible> pAcc;
CComVariant vChild;
HRESULT hr;
hr = AccessibleObjectFromPoint(pt, &pAcc, &vChild);
if (SUCCEEDED(hr))
{
ATLASSERT(V_VT(&vChild) == VT_I4);
hr = pAuto->ElementFromIAccessible(pAcc, V_I4(&vChild), &pElement);
if (SUCCEEDED(hr) && pElement)
{
// Insert code
}
}