Grammatically, both are correct, but they mean slightly different things.
He had them listen attentively — More forceful by "him", connoting an unwillingness to listen (or desire to not listen) on the part of "them."
The guest speaker might have bored the class, but because he was covering material that would be on the next day's test, the teacher had them listen attentively for the entire presentation.
He had them listening attentively — Suggests that the listening was not forced, but rather out of interest or desire.
The professor's talk was so interesting yesterday that he had the whole class listening attentively despite the soon-to-be-due essay on their minds.