Is it only when playing DirectX games?

It sounds like it's a driver problem if it is. Try upgrading your graphics card drivers to the latest available.

It could also be your graphics card or processor overheating, if it spontaneously locks up or restarts automatically. Try installing temperature monitoring software and keeping an eye on the temperature.