
Had this exact same problem not a couple of months ago!
Come to find out, it was the video card. It was almost dead, and was sending weird messages throughout the computer. Before finding out it was the video card, I had the hard drive replaced, as when the repair tech looked at it the first time, the harddrive was almost dead, so he thought it was that. Then he thought it could be the power cord coming from the computer, to the outlet. Changed that, still had the problem.
He checked the video card, and found out it was almost dead and he changed that. Have not had a problem since.
HTH