Reinstall the latest directx drivers if this happens. Your drivers are possibly corrupt or missing. You may need to install or update your video card drivers as well.
Here is the website where you can download the latest directx drivers direct from microsoft.
I had an issue today where I got :
d3dx9_42.dll is missing
This was able fix my problem.