As d3dx9_31.dll file is missing or corrupted, you need to get a new dll file. Here are the steps to replace d3dx9_31.dllfile
Step 1. You can download missing d3dx9_31.dll here: http://www.d3dx9.net/download-missing-d3dx9_31-dll/
Step 2. Paste this file into your system32 or SyWOW64 folder.
Step 3. Navigate to your System32(32Bit OS) or SyWOW64(64Bit OS) Folder.
Note: The location of System32 and SyWOW64 is
C:Windows\System32 (If you are using 32Bit Windows)
C:\Windows\SysWOW64 (if you are using 64Bit Windows)
Step 4. Paste the d3dx9_42.dll file into this folder.
Step 5. Try to run it. It might work now. If not, restart your computer to restore it effectively.