(CNN) -- A Texas man went on a gun attack in two cities late Wednesday, killing four people, including two at his ex-girlfriend's home, police said. He wounded four more.
When he saw that his ex-girlfriend was not at her Dallas home, he stopped shooting there and quickly drove to a second home in the city of DeSoto, where he found her, CNN affiliate WFAA reported.
There, he used "some sort of explosive device," then opened fire on the people inside, said DeSoto police spokeswoman Melissa Franks.
Police arrested him when he ran out of ammunition, she said.
Charges are pending. Dallas and DeSoto investigators are working together on the case. The U.S. Bureau of Alcohol, Tobacco, Firearms and Explosives is investigating the nature of the explosive device, Franks said.
The gunman moved quickly from the first shooting to the second one.
The first emergency call reached Dallas police at 10:30 p.m. Wednesday. When they responded, they found two victims dead, police said. Two more people were wounded but still alive.
At 10:45 p.m., a 911 call came in from the DeSoto home, Franks said. The gunman was still firing at the time. There were children in the home, but Franks would not say if they were hit by gunfire.
Police arrived quickly and found the gunman still at the home.
By the time he fired his last shot there, he had killed two people and wounded two more, Franks said.
She would not say whether or not the gunman shot his ex-girlfriend.
By Paul Caron. Ben Brumfield and Tina Burnside
CNN's Paul Caron and Tina Burnside reported from Atlanta; Ben Brumfield reported and wrote from Atlanta.