I was going crazy trying to fix d3dx9_40.dll is missing error in Heroes of Newerth. The problem was that I couldn’t launch the game because every time I run hon.exe the system error appears saying that d3dx9_40.dll is missing, try reinstalling the program. Reinstalling HoN didn’t solve the problem. However, I realized that the problem is not with the game but with some drivers or with my operating system. After reading a bit about d3dx9_40.dll file I also found an easy fixing method for Heroes of Newerth and other applications.
d3dx9_40.dll is the system library that belongs to The Microsoft DirectX. Sometimes happens that it becomes damaged and programs can’t use it anymore. To fix the d3dx9_40.dll is missing error you need to download and install this library from here: http://fix4dll.com/d3dx9_40_dll.
This fix helped me to resolve d3dx9_40.dll is missing error in Heroes of Newerth and I am sure that it should work for any other application that gives you d3dx9_40.dll is missing error during launching.